jszip-unzip
TypeScript icon, indicating that this package has built-in type declarations

3.4.0-0 • Public • Published

JSZip-unzip

A JSZip version of the unzip command for extracting all the entries from a ZIP archive into a specified directory, creating any required subdirectories.

The target directory can be a physical one (if running in Node.js) or a simulated one by supplying the fs option to unzip. The passed object must support the functions mkdirSync, statSync, and writeFileSync with signatures compatible with Node.js's fs. One such object can be found in memfs.

import unzip from 'jszip-unzip';
import fs from 'fs';
 
unzip(fs.readFileSync('data.zip'), {to: '/tmp/out'})

With memfs:

import unzip from 'jszip-unzip';
import { fs } from 'memfs';
 
async function extract() {   
    var data = await fetch('data.zip'),
        raw = new Uint8Array(await data.arrayBuffer());
    await unzip(raw, {to: '/data', fs});
}

Readme

Keywords

none

Package Sidebar

Install

npm i jszip-unzip

Weekly Downloads

114

Version

3.4.0-0

License

MIT

Unpacked Size

8.94 kB

Total Files

7

Last publish

Collaborators

  • corwin.amber