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 debug=require('debug')('pbf');
|
||||||
|
const gtfsRt=require('../../proto2js/js/gtfs-rt.js');
|
||||||
|
const Pbf = require('pbf');
|
||||||
|
|
||||||
run().catch(err => {
|
run().catch(err => {
|
||||||
debug('run: error')
|
debug('run: error');
|
||||||
console.log(err)
|
console.log(err)
|
||||||
});
|
});
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
debug('run started...')
|
debug('run started...');
|
||||||
debug('run done.')
|
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,
|
"private": true,
|
||||||
"name": "pbf",
|
"name": "pbf-example",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon index.js",
|
"dev": "nodemon index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"author": "Stefan Begerad",
|
"author": "Stefan Begerad",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^2.0.7"
|
"nodemon": "^2.0.7"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"pbf": "^3.2.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue