From 5d338703c4db99c494f92f71b577f4f5d59f9fd3 Mon Sep 17 00:00:00 2001 From: Dobes Vandermeer Date: Mon, 20 Aug 2018 21:48:39 -0700 Subject: [PATCH] Add Open.buffer A new Open method was added, `buffer`, which accepts a `Buffer` to read the ZIP file directory from. This updates the types to reflect that addition. - https://github.com/ZJONSSON/node-unzipper/pull/69/files - https://github.com/ZJONSSON/node-unzipper/issues/54 - Released in version 0.9.2 --- types/unzipper/index.d.ts | 3 ++- types/unzipper/unzipper-tests.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/unzipper/index.d.ts b/types/unzipper/index.d.ts index 034fb5b099..43c50e1818 100644 --- a/types/unzipper/index.d.ts +++ b/types/unzipper/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for unzipper 0.8 +// Type definitions for unzipper 0.9 // Project: https://github.com/ZJONSSON/node-unzipper#readme // Definitions by: s73obrien // Nate @@ -57,6 +57,7 @@ export function unzip( ): Entry; export namespace Open { + function buffer(data: Buffer): Promise; function file(filename: string): Promise; function url( request: ClientRequest, diff --git a/types/unzipper/unzipper-tests.ts b/types/unzipper/unzipper-tests.ts index 7a8fbf9f4a..26cebebdef 100644 --- a/types/unzipper/unzipper-tests.ts +++ b/types/unzipper/unzipper-tests.ts @@ -41,3 +41,4 @@ createReadStream("http://example.org/path/to/archive.zip") const dir1: Promise = Open.file("Z:\\path\\to\\archive.zip"); const dir2: Promise = Open.url(get("url/to/archive.zip"), {}); const dir3: Promise = Open.s3("any", "any"); +const dir4: Promise = Open.buffer(Buffer.from('ZIPDATA'));