Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Tracking issue
about: New features.
title: "[DATE]: [FEATURE NAME]"
labels: tracking issue, needs triage
assignees: mikbry
---

### Description
A clear and concise description of what the issue is about.

### Expected behaviour
If a bug, what do you expect ?

### Actual behaviour
If a bug, what is the current result.

### Steps to reproduce
If a bug, how do you reproduce it :
- step 1
- step 2
- step x
- the bug

### Environnement
Node version
Npm / Yarn
OS
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Fix issues

- [ ] #issuenumber

### Description

{Please describe here the changes}

### Check List

- [ ] respect code conventions and usages
- [ ] tests and 100% coverage
- [ ] well documented
- [ ] self review

### Review targets:
- nodejs / npm / yarn
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Mik
Copyright (c) 2019 Mik BRY

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 32 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# anzip [![Build Status](https://travis-ci.com/mikbry/anzip.svg?token=mRB1zwsyoRAKcamR2qpU)](https://travis-ci.com/mikbry/anzip) [![codecov](https://codecov.io/gh/mikbry/anzip/branch/master/graph/badge.svg?token=K4P0vnM5fh)](https://codecov.io/gh/mikbry/anzip)
# Anzip

[![Build Status][travis-image]][travis-url]
[![codecov][codecov-image]][codecov-url]
[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]

[travis-image]: https://travis-ci.com/mikbry/anzip.svg?token=mRB1zwsyoRAKcamR2qpU
[travis-url]: https://travis-ci.com/mikbry/anzip
[codecov-image]: https://codecov.io/gh/mikbry/anzip/branch/master/graph/badge.svg?token=K4P0vnM5fh
[codecov-url]: https://codecov.io/gh/mikbry/anzip
[npm-image]: https://img.shields.io/npm/v/anzip.svg
[npm-url]: https://npmjs.org/package/anzip
[license-image]: https://img.shields.io/npm/l/anzip.svg
[License-url]:./LICENSE

> Anzip is a library to unzip file archive for Node using only one async function.


Expand All @@ -17,12 +32,12 @@ ___
---

### Install
```
```bash
yarn add anzip
````

Or using npm
```
```bash
npm add anzip
````

Expand All @@ -31,51 +46,53 @@ npm add anzip
### Usage
> Now that ESM support is widely common, `require` should be forgotten.

```
```javascript
import anzip from 'anzip';
```


> Extract file.zip to current path

```
```javascript
await anzip('file.zip');
```


> Extract file.zip to the current path and get output

```
```javascript
const output = await anzip('file.zip');
console.log('duration=', output.duration);
console.log('number of files=', output.files.length);
```

> Extract only README.md from file.zip to current path
```

```javascript
const output = await anzip('file.zip', { pattern: 'README.md', });
console.log('duration=', output.duration);
console.log('number of files=', output.files.length); // Should be one
```

> Extract only README.md from file.zip to output content variable

```
```javascript
const output = await anzip('file.zip', { pattern: 'README.md', outputContent: true });
console.log('duration=', output.duration);
console.log('content=', output.files[0].content);
```

> Extract only README.md from file.zip to output content variable and currentpath
```

```javascript
const output = await anzip('file.zip', { pattern: 'README.md', outputPath: './', outputContent: true });
console.log('duration=', output.duration);
console.log('content=', output.files[0].content);
```

> Extract with an entryHandler to fliter entry

```
```javascript
const outputPath = './path';
const entryHandler = async entry => {
let resp = true;
Expand All @@ -99,7 +116,7 @@ console.log('duration=', output.duration);

> Extract using 2 rules and an entryHandler in one to fliter entry

```
```javascript
const outputPath = './path';
const entryHandler = async entry => {
let resp = true;
Expand Down Expand Up @@ -166,4 +183,7 @@ console.log('duration=', output.duration);
| files[x].content | Buffer | the content of the file available if opts.outputContent=true or rule.outputContent=true |
| files[x].error | Error | if an error occured |

---
---
## Contribution

Read [Contributing Guide](CONTRIBUTING.md) for development setup instructions.