Skip to content

hiteshlala/unzippy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo Unzippy

Status In Development

A Node.js unzip library

  • Zero dependencies.

  • Uncompresses Deflate archives ( default for most zip libraries ).

  • Provides a directory listing of archive.

  • Selectively inflate individual items.

  • Does not verifiy size or calculate CRC32 of artifacts.

Examples

Simplest extraction:

  const { unzip } = require( '@hiteshlala/unzippy' );

  const source = 'path_some_zip_archive.zip';
  const dest = 'path_to_place_to_write_artifacts';

  unzip(  source, out )
  .then( console.log )
  .catch( console.error );

Add more options:

  const { Unzippy } = require( '@hiteshlala/unzippy' );

  const source = 'path_some_zip_archive.zip';
  const dest = 'path_to_place_to_write_artifacts';

  // instantiate archive
  const z = new Unzippy({ 
    src: source, 
    dest: out
  });

  // get a directory listing
  const dir = z.getDir(); // returns an array
  console.log( dir.map( i => i.fName ) );

  // extract a single file - select by index of dir array
  z.extractSingle( 3 )
  .then( console.log )
  .catch( console.error );

  // extract entire directory
  z.unzip()
  .then( console.log )
  .catch( console.error );

API

Class Unzippy

  • new Unzippy( options )

    • Takes an options object:

      {
        src: < String: path to source archive >,
        dest: < String: path to where to unzip >,
      
        // planned options to come in future release:
        // logfile: < Boolean: create a log file>
        // verbose: < Allow logging to console >
      
      }
  • .getDir()

    • Returns an Array containing an Object for each artifact in archive.
  • .extractSingle( id )

    • Extracts a single artifact and returns a Promise.
  • .unzip()

    • Extracts all artifacts and returns a Promise.

unzip

  • unzip( src, dest )

    • src - path to source archive

    • dest - path to where to unzip

License

This project is covered by the License found here.

About

Simple pure Node.js unzip library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published