Unzip Module
A simple Unzipper wrapper for yauzl in nodejs.
Support Promise and nodejs Stream.
Who might care this package
The people
- who use nodejs
- who want a unzip only interface
- who think yauzl is good but its API is hard to use
might want to look at this.
Where is the document
Since this is majorly used in its parent project. You can
🏭 Functions
filterEntries
filterEntries(zip: ZipFile, entries: (string | (entry: Entry) => boolean)[]): Promise<(Entry | undefined)[]>Walk all the entries of the zip and once provided entries are all found, then terminate the walk process
Parameters
- zip:
ZipFileThe zip file - entries:
(string | (entry: Entry) => boolean)[]The entry to read
Return Type
Promise<(Entry | undefined)[]>
Defined in: packages/unzip/index.ts:135
getEntriesRecord
getEntriesRecord(entries: Entry[]): Record<string, Entry>Parameters
- entries:
Entry[]
Return Type
Record<string, Entry>
Defined in: packages/unzip/index.ts:174
open
open(target: OpenTarget, options: Options= ...): Promise<ZipFile>Open a yauzl zip
Parameters
- target:
OpenTargetThe zip path or buffer or file descriptor - options:
OptionsThe option to open
Return Type
Promise<ZipFile>
Defined in: packages/unzip/index.ts:14
openEntryReadStream
openEntryReadStream(zip: ZipFile, entry: Entry, options: ZipFileOptions): Promise<Readable>Open the entry readstream for the zip file
Parameters
- zip:
ZipFileThe zip file object - entry:
EntryThe entry to open - options:
ZipFileOptionsThe options to open stream
Return Type
Promise<Readable>
Defined in: packages/unzip/index.ts:49
readAllEntries
readAllEntries(zipFile: ZipFile): Promise<Entry[]>Walk all entries of the zip file
Parameters
- zipFile:
ZipFileThe zip file object
Return Type
Promise<Entry[]>
Defined in: packages/unzip/index.ts:186
readEntry
readEntry(zip: ZipFile, entry: Entry, options: ZipFileOptions): Promise<Buffer>Read the entry to buffer
Parameters
- zip:
ZipFileThe zip file object - entry:
EntryThe entry to open - options:
ZipFileOptionsThe options to open stream
Return Type
Promise<Buffer>
Defined in: packages/unzip/index.ts:64
walkEntries
walkEntries(zip: ZipFile, entryHandler: (entry: Entry) => boolean | void | Promise<boolean>): Promise<void>Walk all the entries of a unread zip file
Parameters
- zip:
ZipFileThe unread zip file - entryHandler:
(entry: Entry) => boolean | void | Promise<boolean>The handler to recieve entries. Return true or Promise<true> to stop the walk
Return Type
Promise<void>
Defined in: packages/unzip/index.ts:164
walkEntriesGenerator
walkEntriesGenerator(zip: ZipFile): AsyncGenerator<Entry, void, boolean | undefined>Get the async entry generator for the zip file
Parameters
- zip:
ZipFileThe zip file
Return Type
AsyncGenerator<Entry, void, boolean | undefined>
Defined in: packages/unzip/index.ts:79
⏩ Type Aliases
OpenTarget
OpenTarget: string | Buffer | numberDefined in: packages/unzip/index.ts:7