diff --git a/src/scripts/interceptor.js b/src/scripts/interceptor.js index 67bd6706..9f3f7447 100644 --- a/src/scripts/interceptor.js +++ b/src/scripts/interceptor.js @@ -166,7 +166,12 @@ } else { data = data.toString().replace(/\n/g, '\r\n'); - return new Buffer(data, typeof encoding === 'string' ? encoding : 'utf8'); + encoding = (typeof encoding === 'string' ? encoding : 'utf8'); + if (Buffer.hasOwnProperty('from')) { + return Buffer.from(data, encoding); + } else { + return new Buffer(data, encoding); + } } }; @@ -207,4 +212,4 @@ // run the original application entry point -require(process.argv[1]); \ No newline at end of file +require(process.argv[1]);