summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/JSONStream/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/JSONStream/index.js')
-rwxr-xr-xdeps/npm/node_modules/JSONStream/index.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/deps/npm/node_modules/JSONStream/index.js b/deps/npm/node_modules/JSONStream/index.js
index a92967f568..8c587af769 100755
--- a/deps/npm/node_modules/JSONStream/index.js
+++ b/deps/npm/node_modules/JSONStream/index.js
@@ -3,6 +3,8 @@
var Parser = require('jsonparse')
, through = require('through')
+var bufferFrom = Buffer.from && Buffer.from !== Uint8Array.from
+
/*
the value of this.stack that creationix's jsonparse has is weird.
@@ -17,7 +19,7 @@ exports.parse = function (path, map) {
var parser = new Parser()
var stream = through(function (chunk) {
if('string' === typeof chunk)
- chunk = new Buffer(chunk)
+ chunk = bufferFrom ? Buffer.from(chunk) : new Buffer(chunk)
parser.write(chunk)
},
function (data) {