diff --git a/lib/array.js b/lib/array.js index b86ae13..1cf3a27 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] } diff --git a/package.json b/package.json index 3422913..0306fd4 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dependencies": { "array-index": "1", "debug": "2", - "ref": "1" + "ref": "git+https://github.com/lijiadong-git/ref.git" }, "devDependencies": { "bindings": "1",