From ae72afc0c2d626a412a32f0efa280f140e257212 Mon Sep 17 00:00:00 2001 From: Chris Alderson Date: Fri, 20 Apr 2018 17:52:08 +0200 Subject: [PATCH] [fix] Use Buffer.alloc and Buffer.from instead of new Buffer (#1281) --- lib/winston/tail-file.js | 2 +- lib/winston/transports/http.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/winston/tail-file.js b/lib/winston/tail-file.js index a3c4d618a..7a19c2136 100644 --- a/lib/winston/tail-file.js +++ b/lib/winston/tail-file.js @@ -12,7 +12,7 @@ function nop() {} // `tail -f` a file. Options must include file. // module.exports = function tailFile(options, iter) { - const buffer = new Buffer(64 * 1024); + const buffer = Buffer.alloc(64 * 1024); const decode = new StringDecoder('utf8'); const stream = new Stream(); let buff = ''; diff --git a/lib/winston/transports/http.js b/lib/winston/transports/http.js index 1f4bdb06a..bf8de77a1 100644 --- a/lib/winston/transports/http.js +++ b/lib/winston/transports/http.js @@ -202,5 +202,5 @@ Http.prototype._request = function (options, callback) { }).resume(); }); - req.end(new Buffer(JSON.stringify(options), 'utf8')); + req.end(Buffer.from(JSON.stringify(options), 'utf8')); };