From 27cff735cbda309fad4a135ba345db307af1f3b2 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 12 Nov 2019 19:35:17 +0000 Subject: [PATCH] [unzipper] Fix CentralDirectory.extract type (#40240) --- types/unzipper/index.d.ts | 2 +- types/unzipper/unzipper-tests.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/unzipper/index.d.ts b/types/unzipper/index.d.ts index 19b2ede828..1e578ee173 100644 --- a/types/unzipper/index.d.ts +++ b/types/unzipper/index.d.ts @@ -81,7 +81,7 @@ export interface CentralDirectory { offsetToStartOfCentralDirectory: number; commentLength: number; files: File[]; - extract: (opts: ParseOptions) => ParseStream; + extract: (opts: ParseOptions) => Promise; } export interface File { diff --git a/types/unzipper/unzipper-tests.ts b/types/unzipper/unzipper-tests.ts index 68464d5451..70550fb410 100644 --- a/types/unzipper/unzipper-tests.ts +++ b/types/unzipper/unzipper-tests.ts @@ -48,3 +48,10 @@ 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')); + +(async () => { + const cd = await dir1; + await cd.extract({ + path: "path/to/extraction/root" + }); +})();