Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moncefplastin07/deno-zip
Streaming cross-platform zip tool written for Deno 🦕.
https://github.com/moncefplastin07/deno-zip
deno
Last synced: 14 days ago
JSON representation
Streaming cross-platform zip tool written for Deno 🦕.
- Host: GitHub
- URL: https://github.com/moncefplastin07/deno-zip
- Owner: moncefplastin07
- License: mit
- Created: 2020-10-03T18:06:44.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-23T16:22:44.000Z (over 1 year ago)
- Last Synced: 2024-10-01T00:23:33.502Z (about 1 month ago)
- Topics: deno
- Language: TypeScript
- Homepage:
- Size: 81.1 KB
- Stars: 21
- Watchers: 1
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deno Zip archive
Streaming cross-platform zip tool written for Deno 🦕.
### the module require permision below
- **--allow-run**: for running unzipping command in command prompt
- **--allow-read**: check the existence of the file before starting the
decompression process.### import the module in your deno app
```js
import {
compress,
decompress
} from "https://deno.land/x/[email protected]/mod.ts";
```#### Usage:
### Compressing
Compress files and folders to zip file with ``compress`` method
addin: v1.2.0
```js
interface CompressOptions {
overwrite?: boolean;
}
compress(files:string | string[],
archiveName: string = "./archive.zip",
options?: CompressOptions):Promise
decompress(filePath:string, [destinationPath]:string = './', options:{}): Promise
```
**`arguments`**- **files**: (string) of one file or more or array of folders and files paths
- **archiveName**: (string) string of name and destination path of zip file (Where
do you want the get compressed zip file) by default is './archive.zip' (current working
directory (CWD))
- **options**: object of compressing options
- **overwrite**: boolean
-
### Examples:```js
// unZip From File
console.log(await compress("./myfiles")); //=> boolean
console.log(await compress("./mypicter.png", "new-dir/mypicter.zip")); //=> boolean
console.log(await compress(["./mypicters", "./textpalne.txt"], "compressed.zip", {overwrite:true})); //=> boolean```
### Decompressing```js
decompress(filePath:string, destinationPath:string = './', options:{}): Promise
```**`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 The destination path or false if the
extraction process fails.### Examples:
```js
// unZip From File
console.log(await decompress("myfile.zip")); //=> ./
console.log(await decompress("myfile.zip", "new-dir")); //=> new-dir
console.log(
await decompress("myfile.zip", null, {
includeFileName: true,
}),
); //=> myfile
console.log(
await decompress("myfile.zip", "new-dir", {
includeFileName: true,
}),
); //=> new-dir\myfile```
## Contribute with us from [`Here`](https://github.com/moncefplastin07/deno-zip)