Skip to content

Commit ace3ec3

Browse files
committed
Use Buffer.from() instead of new Buffer()
1 parent 034b9c5 commit ace3ec3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function unbzip2Stream() {
3434
return false;
3535
}else{
3636
//console.error('decompressed', chunk.length,'bytes');
37-
push(new Buffer(chunk));
37+
push(Buffer.from(chunk));
3838
return true;
3939
}
4040
}

test/bit_iterator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test('should return the correct bit pattern across byte boundaries', function(t)
55
t.plan(5);
66

77
var bi = bitIterator(function() {
8-
return new Buffer([0x0f,0x10,0x01,0x80]);
8+
return Buffer.from([0x0f,0x10,0x01,0x80]);
99
});
1010

1111
t.equal(bi(16), 0x0f10);
@@ -56,7 +56,7 @@ test('aligns to the byte boundary when passed null', function(t) {
5656
t.plan(3);
5757

5858
var bi = bitIterator(function() {
59-
return new Buffer([0x0f,0x10,0x01,0x80]);
59+
return Buffer.from([0x0f,0x10,0x01,0x80]);
6060
});
6161

6262
t.equal(bi(7), 0x7);

0 commit comments

Comments
 (0)