[unzipper] Fix CentralDirectory.extract type (#40240)

This commit is contained in:
Henry Mercer
2019-11-12 19:35:17 +00:00
committed by Pranav Senthilnathan
parent acda7e1cdb
commit 27cff735cb
2 changed files with 8 additions and 1 deletions

View File

@@ -81,7 +81,7 @@ export interface CentralDirectory {
offsetToStartOfCentralDirectory: number;
commentLength: number;
files: File[];
extract: (opts: ParseOptions) => ParseStream;
extract: (opts: ParseOptions) => Promise<void>;
}
export interface File {

View File

@@ -48,3 +48,10 @@ const dir1: Promise<CentralDirectory> = Open.file("Z:\\path\\to\\archive.zip");
const dir2: Promise<CentralDirectory> = Open.url(get("url/to/archive.zip"), {});
const dir3: Promise<CentralDirectory> = Open.s3("any", "any");
const dir4: Promise<CentralDirectory> = Open.buffer(Buffer.from('ZIPDATA'));
(async () => {
const cd = await dir1;
await cd.extract({
path: "path/to/extraction/root"
});
})();