Skip to content

Commit 4b8f524

Browse files
committed
Added safe-buffer and updated dependencies
1 parent 4acbe24 commit 4b8f524

File tree

4 files changed

+84
-79
lines changed

4 files changed

+84
-79
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ node_js:
66
- '4'
77
- '6'
88
- '7'
9+
- '8'
10+
- '9'
911
branches:
1012
only:
1113
- master

bl.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var DuplexStream = require('readable-stream/duplex')
22
, util = require('util')
3+
, Buffer = require('safe-buffer').Buffer
34

45

56
function BufferList (callback) {
@@ -66,7 +67,7 @@ BufferList.prototype.append = function append (buf) {
6667
if (typeof buf == 'number')
6768
buf = buf.toString()
6869

69-
this._appendBuffer(new Buffer(buf));
70+
this._appendBuffer(Buffer.from(buf));
7071
}
7172

7273
return this
@@ -127,9 +128,9 @@ BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
127128
if (typeof srcEnd != 'number' || srcEnd > this.length)
128129
srcEnd = this.length
129130
if (srcStart >= this.length)
130-
return dst || new Buffer(0)
131+
return dst || Buffer.alloc(0)
131132
if (srcEnd <= 0)
132-
return dst || new Buffer(0)
133+
return dst || Buffer.alloc(0)
133134

134135
var copy = !!dst
135136
, off = this._offset(srcStart)
@@ -165,7 +166,7 @@ BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
165166
}
166167

167168
if (!copy) // a slice, we need something to copy in to
168-
dst = new Buffer(len)
169+
dst = Buffer.allocUnsafe(len)
169170

170171
for (i = off[0]; i < this._bufs.length; i++) {
171172
l = this._bufs[i].length - start

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
],
2525
"license": "MIT",
2626
"dependencies": {
27-
"readable-stream": "^2.0.5"
27+
"readable-stream": "^2.3.5",
28+
"safe-buffer": "^5.1.1"
2829
},
2930
"devDependencies": {
3031
"faucet": "0.0.1",
3132
"hash_file": "~0.1.1",
32-
"tape": "~4.6.0"
33+
"tape": "~4.9.0"
3334
}
3435
}

0 commit comments

Comments
 (0)