first commit
This commit is contained in:
130
build/node_modules/decompress/index.js
generated
vendored
Normal file
130
build/node_modules/decompress/index.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
'use strict';
|
||||
var bufferToVinyl = require('buffer-to-vinyl');
|
||||
var concatStream = require('concat-stream');
|
||||
var streamCombiner = require('stream-combiner2');
|
||||
var vinylFs = require('vinyl-fs');
|
||||
var vinylAssign = require('vinyl-assign');
|
||||
|
||||
/**
|
||||
* Initialize Decompress
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Decompress(opts) {
|
||||
if (!(this instanceof Decompress)) {
|
||||
return new Decompress(opts);
|
||||
}
|
||||
|
||||
this.opts = opts || {};
|
||||
this.streams = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set the source files
|
||||
*
|
||||
* @param {Array|Buffer|String} file
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Decompress.prototype.src = function (file) {
|
||||
if (!arguments.length) {
|
||||
return this._src;
|
||||
}
|
||||
|
||||
this._src = file;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get or set the destination folder
|
||||
*
|
||||
* @param {String} dir
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Decompress.prototype.dest = function (dir) {
|
||||
if (!arguments.length) {
|
||||
return this._dest;
|
||||
}
|
||||
|
||||
this._dest = dir;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a plugin to the middleware stack
|
||||
*
|
||||
* @param {Function} plugin
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Decompress.prototype.use = function (plugin) {
|
||||
this.streams.push(plugin);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decompress archive
|
||||
*
|
||||
* @param {Function} cb
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Decompress.prototype.run = function (cb) {
|
||||
cb = cb || function () {};
|
||||
|
||||
var stream = this.createStream();
|
||||
|
||||
stream.on('error', cb);
|
||||
stream.pipe(concatStream(cb.bind(null, null)));
|
||||
};
|
||||
|
||||
/**
|
||||
* Create stream
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Decompress.prototype.createStream = function () {
|
||||
this.streams.unshift(vinylAssign({extract: true}));
|
||||
this.streams.unshift(this.getFiles());
|
||||
|
||||
if (this.streams.length === 2) {
|
||||
this.use(Decompress.tar(this.opts));
|
||||
this.use(Decompress.tarbz2(this.opts));
|
||||
this.use(Decompress.targz(this.opts));
|
||||
this.use(Decompress.zip(this.opts));
|
||||
}
|
||||
|
||||
if (this.dest()) {
|
||||
this.streams.push(vinylFs.dest(this.dest()));
|
||||
}
|
||||
|
||||
return streamCombiner.obj(this.streams);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get files
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Decompress.prototype.getFiles = function () {
|
||||
if (Buffer.isBuffer(this.src())) {
|
||||
return bufferToVinyl.stream(this.src());
|
||||
}
|
||||
|
||||
return vinylFs.src(this.src());
|
||||
};
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Decompress;
|
||||
module.exports.tar = require('decompress-tar');
|
||||
module.exports.tarbz2 = require('decompress-tarbz2');
|
||||
module.exports.targz = require('decompress-targz');
|
||||
module.exports.zip = require('decompress-unzip');
|
||||
21
build/node_modules/decompress/license
generated
vendored
Normal file
21
build/node_modules/decompress/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
84
build/node_modules/decompress/package.json
generated
vendored
Normal file
84
build/node_modules/decompress/package.json
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"decompress@3.0.0",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "decompress@3.0.0",
|
||||
"_id": "decompress@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-rx3VDQbjv8QyRh033hGzjA2ZG+0=",
|
||||
"_location": "/decompress",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "decompress@3.0.0",
|
||||
"name": "decompress",
|
||||
"escapedName": "decompress",
|
||||
"rawSpec": "3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bin-build",
|
||||
"/gulp-decompress"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/decompress/-/decompress-3.0.0.tgz",
|
||||
"_spec": "3.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "https://github.com/kevva"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kevva/decompress/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"buffer-to-vinyl": "^1.0.0",
|
||||
"concat-stream": "^1.4.6",
|
||||
"decompress-tar": "^3.0.0",
|
||||
"decompress-tarbz2": "^3.0.0",
|
||||
"decompress-targz": "^3.0.0",
|
||||
"decompress-unzip": "^3.0.0",
|
||||
"stream-combiner2": "^1.1.1",
|
||||
"vinyl-assign": "^1.0.1",
|
||||
"vinyl-fs": "^2.2.0"
|
||||
},
|
||||
"description": "Extracting archives made easy",
|
||||
"devDependencies": {
|
||||
"ava": "0.2.0",
|
||||
"rimraf": "^2.2.8",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/kevva/decompress#readme",
|
||||
"keywords": [
|
||||
"bz2",
|
||||
"bzip2",
|
||||
"decompress",
|
||||
"extract",
|
||||
"tar",
|
||||
"tar.bz",
|
||||
"tar.gz",
|
||||
"zip",
|
||||
"unzip"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "decompress",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kevva/decompress.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
||||
136
build/node_modules/decompress/readme.md
generated
vendored
Normal file
136
build/node_modules/decompress/readme.md
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# decompress [](https://travis-ci.org/kevva/decompress)
|
||||
|
||||
> Extracting archives made easy
|
||||
|
||||
*See [decompress-cli](https://github.com/kevva/decompress-cli) for the command-line version.*
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save decompress
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress({mode: '755'})
|
||||
.src('foo.zip')
|
||||
.dest('dest')
|
||||
.use(Decompress.zip({strip: 1}))
|
||||
.run();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### new Decompress(options)
|
||||
|
||||
Creates a new `Decompress` instance.
|
||||
|
||||
#### options.mode
|
||||
|
||||
Type: `string`
|
||||
|
||||
Set mode on the extracted files, i.e `{ mode: '755' }`.
|
||||
|
||||
#### options.strip
|
||||
|
||||
Type: `number`
|
||||
|
||||
Equivalent to `--strip-components` for tar.
|
||||
|
||||
### .src(files)
|
||||
|
||||
#### files
|
||||
|
||||
Type: `array`, `buffer` or `string`
|
||||
|
||||
Set the files to be extracted.
|
||||
|
||||
### .dest(path)
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
Set the destination to where your file will be extracted to.
|
||||
|
||||
### .use(plugin)
|
||||
|
||||
#### plugin
|
||||
|
||||
Type: `function`
|
||||
|
||||
Add a `plugin` to the middleware stack.
|
||||
|
||||
### .run(callback)
|
||||
|
||||
Extract your file with the given settings.
|
||||
|
||||
#### callback(err, files)
|
||||
|
||||
Type: `function`
|
||||
|
||||
The callback will return an array of vinyl files in `files`.
|
||||
|
||||
|
||||
## Plugins
|
||||
|
||||
The following [plugins](https://www.npmjs.org/browse/keyword/decompressplugin) are bundled with decompress:
|
||||
|
||||
* [tar](#tar) — Extract TAR files.
|
||||
* [tar.bz2](#tarbz2) — Extract TAR.BZ files.
|
||||
* [tar.gz](#targz) — Extract TAR.GZ files.
|
||||
* [zip](#zip) — Extract ZIP files.
|
||||
|
||||
### .tar(options)
|
||||
|
||||
Extract TAR files.
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.tar({strip: 1}));
|
||||
```
|
||||
|
||||
### .tarbz2(options)
|
||||
|
||||
Extract TAR.BZ files.
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.tarbz2({strip: 1}));
|
||||
```
|
||||
|
||||
### .targz(options)
|
||||
|
||||
Extract TAR.GZ files.
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.targz({strip: 1}));
|
||||
```
|
||||
|
||||
### .zip(options)
|
||||
|
||||
Extract ZIP files.
|
||||
|
||||
```js
|
||||
const Decompress = require('decompress');
|
||||
|
||||
new Decompress()
|
||||
.use(Decompress.zip({strip: 1}));
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Mårtensson](https://github.com/kevva)
|
||||
Reference in New Issue
Block a user