Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/crc32-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var crc32 = require('crc').crc32;

var CRC32Stream = module.exports = function CRC32Stream(options) {
Transform.call(this, options);
this.checksum = new Buffer(4);
this.checksum = Buffer.allocUnsafe(4);
this.checksum.writeInt32BE(0, 0);

this.rawSize = 0;
Expand All @@ -30,7 +30,7 @@ CRC32Stream.prototype._transform = function(chunk, encoding, callback) {
};

CRC32Stream.prototype.digest = function(encoding) {
var checksum = new Buffer(4);
var checksum = Buffer.allocUnsafe(4);
checksum.writeUInt32BE(this.checksum >>> 0, 0);
return encoding ? checksum.toString(encoding) : checksum;
};
Expand Down
4 changes: 2 additions & 2 deletions lib/deflate-crc32-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var crc32 = require('crc').crc32;
var DeflateCRC32Stream = module.exports = function (options) {
zlib.DeflateRaw.call(this, options);

this.checksum = new Buffer(4);
this.checksum = Buffer.allocUnsafe(4);
this.checksum.writeInt32BE(0, 0);

this.rawSize = 0;
Expand Down Expand Up @@ -49,7 +49,7 @@ DeflateCRC32Stream.prototype.write = function(chunk, enc, cb) {
};

DeflateCRC32Stream.prototype.digest = function(encoding) {
var checksum = new Buffer(4);
var checksum = Buffer.allocUnsafe(4);
checksum.writeUInt32BE(this.checksum >>> 0, 0);
return encoding ? checksum.toString(encoding) : checksum;
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"lib"
],
"engines": {
"node": ">= 4"
"node": ">= 4.5.0"
},
"scripts": {
"test": "mocha --reporter dot"
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function adjustDateByOffset(d, offset) {
module.exports.adjustDateByOffset = adjustDateByOffset;

function binaryBuffer(n) {
var buffer = new Buffer(n);
var buffer = Buffer.allocUnsafe(n);

for (var i = 0; i < n; i++) {
buffer.writeUInt8(i&255, i);
Expand All @@ -35,7 +35,7 @@ module.exports.binaryBuffer = binaryBuffer;
function BinaryStream(size, options) {
Readable.call(this, options);

var buf = new Buffer(size);
var buf = Buffer.allocUnsafe(size);

for (var i = 0; i < size; i++) {
buf.writeUInt8(i&255, i);
Expand Down