Skip to content

Commit 53a84d6

Browse files
Merge pull request #23 from terrierscript/development
v1.0.1
2 parents 50488ed + cf1dffe commit 53a84d6

File tree

6 files changed

+306
-159
lines changed

6 files changed

+306
-159
lines changed

CONTRIBUTING.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Contributing
2+
*This contributing guide was forked from [@PurpleBooth](https://gist.github.com/PurpleBooth/b24679402957c63ec426)*
3+
4+
When contributing to this repository, please first discuss the change you wish to make via issue,
5+
email, or any other method with the owners of this repository before making a change.
6+
7+
Please note we have a code of conduct, please follow it in all your interactions with the project.
8+
9+
## Pull Request Process
10+
11+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
12+
build.
13+
2. Update the README.md with details of changes to the interface, this includes new environment
14+
variables, exposed ports, useful file locations and container parameters.
15+
3. Increase the version numbers in any examples files and the README.md to the new version that this
16+
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
17+
4. You may merge the Pull Request in once you have the sign-off of other developers, or if you
18+
do not have permission to do that, you may request the reviewer to merge it for you.
19+
20+
## Code of Conduct
21+
22+
### Our Pledge
23+
24+
In the interest of fostering an open and welcoming environment, we as
25+
contributors and maintainers pledge to making participation in our project and
26+
our community a harassment-free experience for everyone, regardless of age, body
27+
size, disability, ethnicity, gender identity and expression, level of experience,
28+
nationality, personal appearance, race, religion, or sexual identity and
29+
orientation.
30+
31+
### Our Standards
32+
33+
Examples of behavior that contributes to creating a positive environment
34+
include:
35+
36+
* Using welcoming and inclusive language
37+
* Being respectful of differing viewpoints and experiences
38+
* Gracefully accepting constructive criticism
39+
* Focusing on what is best for the community
40+
* Showing empathy towards other community members
41+
42+
Examples of unacceptable behavior by participants include:
43+
44+
* The use of sexualized language or imagery and unwelcome sexual attention or
45+
advances
46+
* Trolling, insulting/derogatory comments, and personal or political attacks
47+
* Public or private harassment
48+
* Publishing others' private information, such as a physical or electronic
49+
address, without explicit permission
50+
* Other conduct which could reasonably be considered inappropriate in a
51+
professional setting
52+
53+
### Our Responsibilities
54+
55+
Project maintainers are responsible for clarifying the standards of acceptable
56+
behavior and are expected to take appropriate and fair corrective action in
57+
response to any instances of unacceptable behavior.
58+
59+
Project maintainers have the right and responsibility to remove, edit, or
60+
reject comments, commits, code, wiki edits, issues, and other contributions
61+
that are not aligned to this Code of Conduct, or to ban temporarily or
62+
permanently any contributor for other behaviors that they deem inappropriate,
63+
threatening, offensive, or harmful.
64+
65+
### Scope
66+
67+
This Code of Conduct applies both within project spaces and in public spaces
68+
when an individual is representing the project or its community. Examples of
69+
representing a project or community include using an official project e-mail
70+
address, posting via an official social media account, or acting as an appointed
71+
representative at an online or offline event. Representation of a project may be
72+
further defined and clarified by project maintainers.
73+
74+
### Enforcement
75+
76+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
77+
reported by contacting the project team at ulisesgascondev@gmail.com. All
78+
complaints will be reviewed and investigated and will result in a response that
79+
is deemed necessary and appropriate to the circumstances. The project team is
80+
obligated to maintain confidentiality with regard to the reporter of an incident.
81+
Further details of specific enforcement policies may be posted separately.
82+
83+
Project maintainers who do not follow or enforce the Code of Conduct in good
84+
faith may face temporary or permanent repercussions as determined by other
85+
members of the project's leadership.
86+
87+
### Attribution
88+
89+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
90+
available at [http://contributor-covenant.org/version/1/4][version]
91+
92+
[homepage]: http://contributor-covenant.org
93+
[version]: http://contributor-covenant.org/version/1/4/

LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
The BSD 2-Clause License
2+
Copyright © 2014 terrierscript
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
[![travis](https://travis-ci.org/inuscript/gulp-unzip.svg)](https://travis-ci.org/inuscript/gulp-unzip)
1+
[![travis](https://travis-ci.org/terrierscript/gulp-unzip.svg)](https://travis-ci.org/terrierscript/gulp-unzip)
2+
![dependencies](https://img.shields.io/david/terrierscript/gulp-unzip.svg)
3+
![devDependencies](https://img.shields.io/david/dev/terrierscript/gulp-unzip.svg)
4+
![Downloads per Week NPM](https://img.shields.io/npm/dw/gulp-unzip.svg)
5+
![Open PRs](https://img.shields.io/github/issues-pr/terrierscript/gulp-unzip.svg)
6+
![Open Issues](https://img.shields.io/github/issues-raw/terrierscript/gulp-unzip.svg)
7+
8+
29
# gulp-unzip
310
> gulp plugin for unzip file.
411
5-
# Usage
12+
### Usage
13+
14+
```bash
15+
npm install gulp-unzip --save
16+
```
617

718
```js
819
var unzip = require('gulp-unzip')
@@ -13,9 +24,9 @@ gulp.task('filter_sample', function(){
1324
})
1425
```
1526

16-
# Options
27+
### Options
1728

18-
## filter
29+
#### filter
1930

2031
You can provide a `filter` option. It should be a function that gets an `entry` as an argument and returns `true` or `false`.
2132

@@ -35,26 +46,33 @@ gulp.task('filter_sample', function(){
3546
})
3647
```
3748

38-
## keepEmpty
49+
#### keepEmpty
3950

4051
You can provide `true` or `false` in `keepEmpty` for whether you want to extract empty files from the archive or not. Defaults to `false`.
4152

4253
```js
4354
gulp.task('filter_sample', function(){
4455
gulp.src("./download/bootstrap-3.1.1-dist.zip")
4556
.pipe(unzip({ keepEmpty : true }))
46-
...
57+
//...
4758
})
4859
```
4960

50-
# Entry
61+
### Contributors
62+
63+
If you want to contribute to the project, please check de [Contribution Guidelines](CONTRIBUTING.md)
5164

52-
For more info, go to [node-unzip](https://github.com/EvanOxfeld/node-unzip).
65+
**Author**
66+
- [terrierscript (@terrierscript)](https://github.com/terrierscript)
5367

54-
- `entry.size`, returns the file size
55-
- `entry.type`, returns `Directory` or `File`
56-
- `entry.path`, returns the file path in the zip file
68+
**Maintainers**
69+
- [Ulises Gascón (@ulisesGascon)](https://github.com/ulisesGascon)
5770

58-
# Known issue
59-
- Cause `RangeError: Maximum call stack size exceeded` when open large zip file
60-
- https://github.com/inuscript/gulp-unzip/issues/2
71+
**Contributors**
72+
- [Joey Cozza (@joeycozza)](https://github.com/joeycozza)
73+
- [Joe Pettersson (@Joe8Bit)](https://github.com/Joe8Bit)
74+
- [Erik Vold (@erikvold)](https://github.com/erikvold)
75+
- [hami (@hami-jp)](https://github.com/hami-jp)
76+
- [Selwyn (@Selwyn)](https://github.com/Siilwyn)
77+
- [João Moreno (@joaomoreno)](https://github.com/joaomoreno)
78+
- [Evan Oxfeld (@EvanOxfeld)](https://github.com/EvanOxfeld)

index.js

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,41 @@
1-
var through = require('through2');
2-
var unzip = require('unzipper')
3-
var fs = require('fs')
4-
var defaults = require('defaults')
5-
var fancyLog = require('fancy-log')
6-
var Vinyl = require('vinyl')
1+
const through = require('through2').obj,
2+
unzip = require('unzipper'),
3+
Vinyl = require('vinyl');
74

8-
module.exports = function(options){
5+
module.exports = (options = {}) => {
6+
97
function transform(file, enc, callback){
108
if (file.isNull()) {
119
this.push(file);
1210
return callback();
1311
}
1412

15-
var opts = {};
16-
options = options || {};
17-
opts.filter = options.filter || function () { return true; };
13+
const opts = {};
14+
opts.filter = options.filter || (() => true);
1815
opts.keepEmpty = options.keepEmpty || false;
1916

20-
// unzip file
21-
var self = this
2217
file.pipe(unzip.Parse())
23-
.on('entry', function(entry){
24-
var chunks = []
18+
.on('entry', entry => {
19+
const chunks = [];
2520
if(!opts.filter(entry)){
26-
entry.autodrain()
27-
// skip entry
28-
return
21+
entry.autodrain();
22+
return;
2923
}
30-
31-
entry.pipe(through.obj(function(chunk, enc, cb){
32-
// fancyLog("Find file: "+ entry.path)
33-
chunks.push(chunk)
34-
cb()
35-
}, function(cb){
36-
if(entry.type == 'File' && (chunks.length > 0 || opts.keepEmpty)){
37-
self.push(new Vinyl({
24+
25+
entry.pipe(through((chunk, enc, cb) => {
26+
chunks.push(chunk);
27+
cb();
28+
}, cb => {
29+
if(entry.type === 'File' && (chunks.length > 0 || opts.keepEmpty)){
30+
this.push(new Vinyl({
3831
cwd : "./",
3932
path : entry.path,
4033
contents: Buffer.concat(chunks)
41-
}))
34+
}));
4235
}
43-
cb()
44-
}))
45-
}).on('close', function(){
46-
callback()
47-
})
36+
cb();
37+
}));
38+
}).on('close', callback);
4839
}
49-
return through.obj(transform);
50-
}
40+
return through(transform);
41+
};

package.json

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "gulp-unzip",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "gulp plugin for unzip",
55
"main": "index.js",
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/inuscript/gulp-unzip.git"
8+
"url": "https://github.com/terrierscript/gulp-unzip.git"
99
},
1010
"scripts": {
1111
"test": "mocha"
@@ -16,19 +16,47 @@
1616
"zip",
1717
"package"
1818
],
19-
"author": "inuscript",
19+
"author": {
20+
"name": "terrierscript",
21+
"url": "https://github.com/terrierscript"
22+
},
23+
"contributors": [
24+
{
25+
"name":"Joey Cozza",
26+
"url": "https://github.com/joeycozza"
27+
},{
28+
"name":"Joe Pettersson",
29+
"url": "https://github.com/Joe8Bit"
30+
},{
31+
"name":"Erik Vold",
32+
"url": "https://github.com/erikvold"
33+
},{
34+
"name":"hami",
35+
"url": "https://github.com/hami-jp"
36+
},{
37+
"name":"Selwyn",
38+
"url": "https://github.com/Siilwyn"
39+
},{
40+
"name":"João Moreno",
41+
"url": "https://github.com/joaomoreno"
42+
},{
43+
"name":"Evan Oxfeld",
44+
"url": "https://github.com/EvanOxfeld"
45+
},{
46+
"name": "Ulises Gascón",
47+
"url": "https://github.com/ulisesGascon"
48+
}
49+
],
2050
"license": "BSD-2-Clause",
2151
"dependencies": {
22-
"defaults": "^1.0.0",
23-
"fancy-log": "^1.3.2",
24-
"through2": "^0.4.1",
25-
"unzipper": "^0.7.1",
26-
"vinyl": "^1.2.0"
52+
"through2": "3.0.0",
53+
"unzipper": "0.9.10",
54+
"vinyl": "1.2.0"
2755
},
2856
"devDependencies": {
29-
"mocha": "^1.18.0",
30-
"assert-plus": "^0.1.5",
31-
"gulp-concat": "^2.2.0",
32-
"minimatch": "^0.2.14"
57+
"mocha": "5.2.0",
58+
"assert-plus": "1.0.0",
59+
"gulp-concat": "2.6.1",
60+
"minimatch": "3.0.4"
3361
}
3462
}

0 commit comments

Comments
 (0)