feat: require pbf
This commit is contained in:
parent
6f5d50667f
commit
30edb85fe8
16
pbf/index.js
16
pbf/index.js
|
@ -1,11 +1,21 @@
|
|||
const debug=require('debug')('pbf');
|
||||
const gtfsRt=require('../../proto2js/js/gtfs-rt.js');
|
||||
const Pbf = require('pbf');
|
||||
|
||||
run().catch(err => {
|
||||
debug('run: error')
|
||||
debug('run: error');
|
||||
console.log(err)
|
||||
});
|
||||
|
||||
async function run() {
|
||||
debug('run started...')
|
||||
debug('run done.')
|
||||
debug('run started...');
|
||||
const FeedMessage = gtfsRt.FeedMessage;
|
||||
const buffer=[];
|
||||
// read
|
||||
debug('create pbf');
|
||||
const pbf = new Pbf(buffer);
|
||||
debug('create obj');
|
||||
const obj = FeedMessage.read(pbf);
|
||||
debug('use obj');
|
||||
debug('run done.');
|
||||
}
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
{
|
||||
"private":true,
|
||||
"name": "pbf",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "nodemon index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Stefan Begerad",
|
||||
"license": "GPL-3.0",
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.7"
|
||||
},
|
||||
"private": true,
|
||||
"name": "pbf-example",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "nodemon index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Stefan Begerad",
|
||||
"license": "GPL-3.0",
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"pbf": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue