From 08810e5ba601eacfb6ebf32f38e9ed8088f6a0fc Mon Sep 17 00:00:00 2001 From: FLYING BISONS Date: Wed, 15 May 2024 00:00:57 +0200 Subject: [PATCH] Update Buffer indication --- lib/matcher-stream.js | 4 ++-- lib/unzip-stream.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/matcher-stream.js b/lib/matcher-stream.js index 6818160..c3090c5 100644 --- a/lib/matcher-stream.js +++ b/lib/matcher-stream.js @@ -14,7 +14,7 @@ function MatcherStream(patternDesc, matchFn) { this.requiredLength = this.pattern.length; if (patternDesc.requiredExtraSize) this.requiredLength += patternDesc.requiredExtraSize; - this.data = new Buffer(''); + this.data = Buffer.from(''); this.bytesSoFar = 0; this.matchFn = matchFn; @@ -57,7 +57,7 @@ MatcherStream.prototype.checkDataChunk = function (ignoreMatchZero) { var finished = this.matchFn ? this.matchFn(this.data, this.bytesSoFar) : true; if (finished) { - this.data = new Buffer(''); + this.data = Buffer.from(''); return; } diff --git a/lib/unzip-stream.js b/lib/unzip-stream.js index 1a503b5..bef8198 100644 --- a/lib/unzip-stream.js +++ b/lib/unzip-stream.js @@ -44,7 +44,7 @@ function UnzipStream(options) { stream.Transform.call(this); this.options = options || {}; - this.data = new Buffer(''); + this.data = Buffer.from(''); this.state = states.STREAM_START; this.skippedBytes = 0; this.parsedEntity = null; @@ -306,7 +306,7 @@ UnzipStream.prototype._prepareOutStream = function (vars, entry) { }; if (!fileSizeKnown) { - var pattern = new Buffer(4); + var pattern = Buffer.alloc(4); pattern.writeUInt32LE(SIG_DATA_DESCRIPTOR, 0); var zip64Mode = vars.extra.zip64Mode; var extraSize = zip64Mode ? 20 : 12;