Skip to content

Unzip Module

npm versionDownloadsInstall sizenpmBuild Status

A simple Unzipper wrapper for yauzl in nodejs.

Support Promise and nodejs Stream.

Who might care this package

The people

  1. who use nodejs
  2. who want a unzip only interface
  3. 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

ts
filterEntries(zip: ZipFile, entries: (string | Function)[]): Promise<(Entry | undefined)[]>

Walk all the entries of the zip and once provided entries are all found, then terminate the walk process

Parameters

  • zip: ZipFile The zip file
  • entries: (string | Function)[] The entry to read

Return Type

  • Promise<(Entry | undefined)[]>

Defined in: packages/unzip/index.ts:125

getEntriesRecord

ts
getEntriesRecord(entries: Entry[]): Record<string, Entry>

Parameters

  • entries: Entry[]

Return Type

  • Record<string, Entry>

Defined in: packages/unzip/index.ts:164

open

ts
open(target: OpenTarget, options: Options= ...): Promise<ZipFile>

Open a yauzl zip

Parameters

  • target: OpenTarget The zip path or buffer or file descriptor
  • options: Options The option to open

Return Type

  • Promise<ZipFile>

Defined in: packages/unzip/index.ts:14

openEntryReadStream

ts
openEntryReadStream(zip: ZipFile, entry: Entry, options: ZipFileOptions): Promise<Readable>

Open the entry readstream for the zip file

Parameters

  • zip: ZipFile The zip file object
  • entry: Entry The entry to open
  • options: ZipFileOptions The options to open stream

Return Type

  • Promise<Readable>

Defined in: packages/unzip/index.ts:39

readAllEntries

ts
readAllEntries(zipFile: ZipFile): Promise<Entry[]>

Walk all entries of the zip file

Parameters

  • zipFile: ZipFile The zip file object

Return Type

  • Promise<Entry[]>

Defined in: packages/unzip/index.ts:176

readEntry

ts
readEntry(zip: ZipFile, entry: Entry, options: ZipFileOptions): Promise<Buffer>

Read the entry to buffer

Parameters

  • zip: ZipFile The zip file object
  • entry: Entry The entry to open
  • options: ZipFileOptions The options to open stream

Return Type

  • Promise<Buffer>

Defined in: packages/unzip/index.ts:54

walkEntries

ts
walkEntries(zip: ZipFile, entryHandler: Function): Promise<void>

Walk all the entries of a unread zip file

Parameters

  • zip: ZipFile The unread zip file
  • entryHandler: Function The handler to recieve entries. Return true or Promise<true> to stop the walk

Return Type

  • Promise<void>

Defined in: packages/unzip/index.ts:154

walkEntriesGenerator

ts
walkEntriesGenerator(zip: ZipFile): AsyncGenerator<Entry, void, boolean | undefined>

Get the async entry generator for the zip file

Parameters

  • zip: ZipFile The zip file

Return Type

  • AsyncGenerator<Entry, void, boolean | undefined>

Defined in: packages/unzip/index.ts:69

⏩ Type Aliases

OpenTarget

ts
OpenTarget: string | Buffer | number

Defined in: packages/unzip/index.ts:7