We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eaf9f0a commit e93286eCopy full SHA for e93286e
src/reader.js
@@ -312,9 +312,14 @@ Reader.prototype.bytes = function read_bytes() {
312
this.pos += length;
313
if (Array.isArray(this.buf)) // plain array
314
return this.buf.slice(start, end);
315
- return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1
316
- ? new this.buf.constructor(0)
317
- : this._slice.call(this.buf, start, end);
+
+ if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1
+ var nativeBuffer = util.Buffer;
318
+ return nativeBuffer
319
+ ? nativeBuffer.alloc(0)
320
+ : new this.buf.constructor(0);
321
+ }
322
+ return this._slice.call(this.buf, start, end);
323
};
324
325
/**
0 commit comments