-
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.
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 );
-
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( src, dest )
-
src - path to source archive
-
dest - path to where to unzip
-
This project is covered by the License found here.