From 3368a4f4ddcda6e9654b91db89ddca3e3e7a15ec Mon Sep 17 00:00:00 2001 From: Gildas Date: Wed, 21 Aug 2024 16:08:25 +0200 Subject: [PATCH] add `offset` option --- index.d.ts | 4 ++++ lib/core/zip-writer.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 84de0c57..413cefb7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1372,6 +1372,10 @@ export interface ZipWriterConstructorOptions { * `true` to write encrypted data when `passThrough` is set to `true`. */ encrypted?: boolean; + /** + * The offset of the first entry in the zip file. + */ + offset?: number; /** * Encode the filename and the comment of the entry. * diff --git a/lib/core/zip-writer.js b/lib/core/zip-writer.js index 2371d87d..cc85bc3b 100644 --- a/lib/core/zip-writer.js +++ b/lib/core/zip-writer.js @@ -119,7 +119,7 @@ class ZipWriter { config: getConfiguration(), files: new Map(), filenames: new Set(), - offset: writer.writable.size, + offset: options.offset === UNDEFINED_VALUE ? writer.writable.size : options.offset, pendingEntriesSize: 0, pendingAddFileCalls: new Set(), bufferedWrites: 0