Skip to content

Commit

Permalink
docs: improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
papb committed Mar 21, 2020
1 parent 41b8a0f commit 4d9d7f9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Cross-platform
* [Simple Promise-based API](https:/papb/zip#api), for your simple zipping needs
* No external binaries needed
* Outputs to temporary folder if you do not specify an output path


## Install
Expand All @@ -23,10 +24,18 @@ $ npm install @papb/zip
const { zip, zipContents, unzip } = require('@papb/zip');

(async () => {
await zip('path/to/folder/foo', 'output.zip');
await zipContents('path/to/folder/bar', 'output.zip');
await unzip('output.zip', 'path/to/folder/baz');
await unzip('output.zip', 'path/to/folder/baz');
await zip('path/to/folder/foo', 'foo.zip');
await zipContents('path/to/folder/bar', 'bar.zip');
await unzip('baz.zip', 'path/to/folder/baz');
await unzip('baz.zip', 'path/to/folder/baz');

// If you don't specify an output path, a temp path is used:
const zipped = await zip('path/to/folder/foo');
console.log(zipped);
//=> '/path/to/some/temp/folder/output.zip'
const unzipped = await unzip('foo.zip');
console.log(unzipped);
//=> '/path/to/some/temp/folder'
})();
```

Expand Down

0 comments on commit 4d9d7f9

Please sign in to comment.