Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

Decompressor

Decompressor: function

Notice: Not to be used for directly decompressing archives. For that, use the unzzz function documented below. This type is for developing plugins that can extend the number of supported compression methods.

A function that can be used by unzzz to decompress a buffer and extract a file from an archive.

The cdl parameter can sometimes be ignored, but certain compression methods will set values on this object (such as the bitFlags property) that must be used by the decompressor.

Type declaration

Functions

crc32

  • crc32(data: Buffer | Uint8Array | number[]): number
  • Parameters

    • data: Buffer | Uint8Array | number[]

    Returns number

unzzz

  • unzzz(source: Buffer | string): Promise<Unzzz>
  • This function returns a promise which will fulfill with an Unzzz, an actionable class that enables you to interact with the archive.

    import unzzz from 'unzzz';
    
    const archive = await unzzz( 'archive.zip' );
    const uncompressedData = await archive.unzipBuffer( fileName );
    
    let i = 0;
    for ( const name in archive.files ) {
      // It's generally a bad idea to use the name given in the archive
      // when writting a file to disk. See notes on the unzipFile method
      // for details on why.
      // Something like this is a much better solution.
      // Files output: 1.js, 2.jpg, 3.html, etc.
      archive.unzipFile( name, `${i++}${path.extname( name )}` );
    }

    Parameters

    • source: Buffer | string

      Can be either a path to where the archive is stored on disk or a buffer of a valid zip archive.

    Returns Promise<Unzzz>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc