Skip to content
Last Updated
Mar 28, 2025, 03:08

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 | (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: ZipFile The zip file
  • entries: (string | (entry: Entry) => boolean)[] The entry to read

Return Type ​

  • Promise<(Entry | undefined)[]>

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

getEntriesRecord ​

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

Parameters ​

  • entries: Entry[]

Return Type ​

  • Record<string, Entry>

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

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:49

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:186

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:64

walkEntries ​

ts
walkEntries(zip: ZipFile, entryHandler: (entry: Entry) => boolean | void | Promise<boolean>): Promise<void>

Walk all the entries of a unread zip file

Parameters ​

  • zip: ZipFile The 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 ​

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:79

⏩ Type Aliases ​

OpenTarget ​

ts
OpenTarget: string | Buffer | number

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