diff --git a/src/bufferutils.js b/src/bufferutils.js index 2ee3542..a68fd31 100644 --- a/src/bufferutils.js +++ b/src/bufferutils.js @@ -42,7 +42,7 @@ function reverseBuffer(buffer) { } exports.reverseBuffer = reverseBuffer; function cloneBuffer(buffer) { - const clone = Buffer.alloc(buffer.length); + const clone = Buffer.allocUnsafe(buffer.length); buffer.copy(clone); return clone; } diff --git a/ts_src/bufferutils.ts b/ts_src/bufferutils.ts index 2025f88..9005f2a 100644 --- a/ts_src/bufferutils.ts +++ b/ts_src/bufferutils.ts @@ -49,7 +49,7 @@ export function reverseBuffer(buffer: Buffer): Buffer { } export function cloneBuffer(buffer: Buffer): Buffer { - const clone = Buffer.alloc(buffer.length); + const clone = Buffer.allocUnsafe(buffer.length); buffer.copy(clone); return clone; }