From 54013201fc76bf42de5c1395e1ba60d40a9f8976 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 26 Mar 2018 00:31:49 +0200 Subject: [PATCH] Use `Buffer.from()` instead of `new Buffer` The `Buffer` constructor is deprecated, we should use `Buffer.from()` instead. Refs: https://github.com/nodejs/node/issues/19079 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 0f15c81..f50d81f 100644 --- a/index.js +++ b/index.js @@ -267,7 +267,7 @@ class WriteStream extends EE { write (buf, enc) { if (typeof buf === 'string') - buf = new Buffer(buf, enc) + buf = Buffer.from(buf, enc) if (this[_ended]) { this.emit('error', new Error('write() after end()'))