Skip to content

Commit

Permalink
Add compatibily with ancient nodejs (such as Ubuntu 16.04) where Buff…
Browse files Browse the repository at this point in the history
…er.from is not available (#88)
  • Loading branch information
rouault authored and mourner committed Nov 19, 2017
1 parent 68303ad commit afcbe2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/geobuf2json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ input.pipe(concat(function(buf) {
// JSON.parse(data);
// console.timeEnd('JSON.parse');

process.stdout.write(Buffer.from(data));
process.stdout.write(Buffer.allocUnsafe ? Buffer.from(data) : new Buffer(data));
}));
3 changes: 2 additions & 1 deletion bin/json2geobuf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ input.pipe(concat(function(buf) {
// console.timeEnd('JSON.stringify');

// console.time('encode');
var buffer = Buffer.from(encode(geojson, new Pbf()));
var pbf = encode(geojson, new Pbf());
var buffer = Buffer.allocUnsafe ? Buffer.from(pbf) : new Buffer(pbf);
// console.timeEnd('encode');

process.stdout.write(buffer);
Expand Down

0 comments on commit afcbe2f

Please sign in to comment.