Skip to content

Commit

Permalink
Avoid using deprecated Buffer API (#3)
Browse files Browse the repository at this point in the history
Use Buffer.from when it's available instead of 'new Bufer(arr)'

Refs:
https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor
  • Loading branch information
ChALkeR authored and mafintosh committed Mar 2, 2018
1 parent d35a407 commit c703a5d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
var stream = require('readable-stream')
var inherits = require('inherits')

var SIGNAL_FLUSH = new Buffer([0])
var SIGNAL_FLUSH
if (Buffer.from && Buffer.from !== Uint8Array.from) {
SIGNAL_FLUSH = Buffer.from([0])
} else {
SIGNAL_FLUSH = new Buffer([0])
}

module.exports = WriteStream

Expand Down

0 comments on commit c703a5d

Please sign in to comment.