diff --git a/packbytes.mjs b/packbytes.mjs index 183e55f..0e290b2 100644 --- a/packbytes.mjs +++ b/packbytes.mjs @@ -273,7 +273,7 @@ export class PackBytes { } checkSize(bytes) { if (bytes + this.offset > this.dataview.byteLength) { - if (false) this.dataview = new DataView(this.dataview.buffer.transfer(this.dataview.byteLength * 2)); + if (this.dataview.buffer.transfer) this.dataview = new DataView(this.dataview.buffer.transfer(this.dataview.byteLength * 2)); else { // backwards compatible for <= Node v20 const arraybuffer = new ArrayBuffer(this.dataview.byteLength * 2); new Uint8Array(arraybuffer).set(new Uint8Array(this.dataview.buffer));