How to use the protoFromFile function from protobufjs

Find comprehensive JavaScript protobufjs.protoFromFile code examples handpicked from public code repositorys.

2
3
4
5
6
7
8
9
10
11
var protobuf = require('protobufjs');
var director = require('./director.js');
var converter = require('./converter.js');
var tile = require('./tile.js');

var proto = protobuf.protoFromFile("./../proto/vector_tile.proto");
var MapnikVector = proto.build("mapnik.vector");

parse = function (file) {
    var data = fs.readFileSync(file);
fork icon2
star icon5
watch icon4

+ 15 other calls in file

211
212
213
214
215
216
217
218
219
* @throws Will throw an error if the path or protofile aren't legit. 
* Won't break the reader because assignment never happens.
*/

   try {
       this.feedMessageDecoder =  ProtoBuf.protoFromFile(this.config.protofilePath)
                                          .build('transit_realtime')
                                          .FeedMessage.decode ;
   } catch (err) {
fork icon0
star icon0
watch icon11

+ 3 other calls in file