Skip to content

Commit

Permalink
Use Buffer.from() instead of new Buffer
Browse files Browse the repository at this point in the history
The `Buffer` constructor is deprecated, we should
use `Buffer.from()` instead.

Refs: nodejs/node#19079
  • Loading branch information
addaleax authored and ruyadorno committed Jan 20, 2020
1 parent 0fe1b24 commit 8b16337
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,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()'))
Expand Down

0 comments on commit 8b16337

Please sign in to comment.