Skip to content

Commit

Permalink
Use Buffer.from() instead of new Buffer()
Browse files Browse the repository at this point in the history
  • Loading branch information
regular committed Feb 2, 2019
1 parent 034b9c5 commit ace3ec3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function unbzip2Stream() {
return false;
}else{
//console.error('decompressed', chunk.length,'bytes');
push(new Buffer(chunk));
push(Buffer.from(chunk));
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/bit_iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test('should return the correct bit pattern across byte boundaries', function(t)
t.plan(5);

var bi = bitIterator(function() {
return new Buffer([0x0f,0x10,0x01,0x80]);
return Buffer.from([0x0f,0x10,0x01,0x80]);
});

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

var bi = bitIterator(function() {
return new Buffer([0x0f,0x10,0x01,0x80]);
return Buffer.from([0x0f,0x10,0x01,0x80]);
});

t.equal(bi(7), 0x7);
Expand Down

0 comments on commit ace3ec3

Please sign in to comment.