Deno Zip archive
Streaming cross-platform unzip tool written for Deno 🦕.
the module require permision below
- --allow-run
- --allow-env
- --unstable
import the module in your deno app
import { unZipFromFile, unZipFromURL } from 'https://deno.land/x/zip@v1.1.0/mod.ts'
or from nest.land
packages
import { unZipFromFile, unZipFromURL } from 'https://x.nest.land/zip@v1.1.0/mod.ts'
Usage:
unZipFromFile([filePath]:string, [destinationPath]:string = './', [options]:{}): Promise<string | false>
arguments
- filePath: string of zip file path.
- destinationPath: (null|string) null or string of destination path (Where do you want the unzipped files to be) as default is './' (current working directory (CWD))
- options: object of unzipping options
return
Promise<string | false> The destination path or false if the extraction process fails.
Examples:
// unZip From File
console.log(await unZipFromFile('myfile.zip')) //=> ./
console.log(await unZipFromFile('myfile.zip', 'new-dir')) //=> new-dir
console.log(await unZipFromFile('myfile.zip', null, {
includeFileName: true
})) //=> myfile
console.log(await unZipFromFile('myfile.zip', 'new-dir', {
includeFileName: true
})) //=> new-dir\myfile
//
console.log(await unZipFromURL('https://github.com/moncefplastin07/deno-zip/archive/master.zip') //=> ./
NEW features
unZipFromURL
: now You can download the zip file and unzipping them directly (You can use the other arguments , such as unZip From File like destinationPath
and options
)