diff --git a/lib/array.js b/lib/array.js index 08223a2..7c1bba3 100644 --- a/lib/array.js +++ b/lib/array.js @@ -36,14 +36,14 @@ module.exports = function Array (_type, _length) { // use the "fixedLength" if provided, otherwise throw an Error if (fixedLength > 0) { this.length = fixedLength - this.buffer = new Buffer(this.length * item_size) + this.buffer = Buffer.alloc(this.length * item_size) } else { throw new Error('A "length", "array" or "buffer" must be passed as the first argument') } } else if ('number' == typeof data) { // new IntArray(69) this.length = data - this.buffer = new Buffer(this.length * item_size) + this.buffer = Buffer.alloc(this.length * item_size) } else if (isArray(data)) { // new IntArray([ 1, 2, 3, 4, 5 ], {len}) // use optional "length" if provided, otherwise use "fixedLength, otherwise @@ -60,7 +60,7 @@ module.exports = function Array (_type, _length) { throw new Error('array length must be at least ' + len + ', got ' + data.length) } this.length = len - this.buffer = new Buffer(len * item_size) + this.buffer = Buffer.alloc(len * item_size) for (var i = 0; i < len; i++) { this[i] = data[i] }