mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-07 07:30:50 +00:00
fix
This commit is contained in:
59
node_modules/decompress-tar/index.js
generated
vendored
Normal file
59
node_modules/decompress-tar/index.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
const fileType = require('file-type');
|
||||
const isStream = require('is-stream');
|
||||
const tarStream = require('tar-stream');
|
||||
|
||||
module.exports = () => input => {
|
||||
if (!Buffer.isBuffer(input) && !isStream(input)) {
|
||||
return Promise.reject(new TypeError(`Expected a Buffer or Stream, got ${typeof input}`));
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(input) && (!fileType(input) || fileType(input).ext !== 'tar')) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
const extract = tarStream.extract();
|
||||
const files = [];
|
||||
|
||||
extract.on('entry', (header, stream, cb) => {
|
||||
const chunk = [];
|
||||
|
||||
stream.on('data', data => chunk.push(data));
|
||||
stream.on('end', () => {
|
||||
const file = {
|
||||
data: Buffer.concat(chunk),
|
||||
mode: header.mode,
|
||||
mtime: header.mtime,
|
||||
path: header.name,
|
||||
type: header.type
|
||||
};
|
||||
|
||||
if (header.type === 'symlink' || header.type === 'link') {
|
||||
file.linkname = header.linkname;
|
||||
}
|
||||
|
||||
files.push(file);
|
||||
cb();
|
||||
});
|
||||
});
|
||||
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
if (!Buffer.isBuffer(input)) {
|
||||
input.on('error', reject);
|
||||
}
|
||||
|
||||
extract.on('finish', () => resolve(files));
|
||||
extract.on('error', reject);
|
||||
});
|
||||
|
||||
extract.then = promise.then.bind(promise);
|
||||
extract.catch = promise.catch.bind(promise);
|
||||
|
||||
if (Buffer.isBuffer(input)) {
|
||||
extract.end(input);
|
||||
} else {
|
||||
input.pipe(extract);
|
||||
}
|
||||
|
||||
return extract;
|
||||
};
|
9
node_modules/decompress-tar/license
generated
vendored
Normal file
9
node_modules/decompress-tar/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
|
||||
|
||||
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.
|
73
node_modules/decompress-tar/package.json
generated
vendored
Normal file
73
node_modules/decompress-tar/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "decompress-tar@^4.0.0",
|
||||
"_id": "decompress-tar@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==",
|
||||
"_location": "/decompress-tar",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "decompress-tar@^4.0.0",
|
||||
"name": "decompress-tar",
|
||||
"escapedName": "decompress-tar",
|
||||
"rawSpec": "^4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/decompress",
|
||||
"/decompress-tarbz2",
|
||||
"/decompress-targz",
|
||||
"/decompress-tarxz"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz",
|
||||
"_shasum": "718cbd3fcb16209716e70a26b84e7ba4592e5af1",
|
||||
"_spec": "decompress-tar@^4.0.0",
|
||||
"_where": "C:\\Users\\matia\\Musix\\node_modules\\decompress",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "https://github.com/kevva"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kevva/decompress-tar/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"file-type": "^5.2.0",
|
||||
"is-stream": "^1.1.0",
|
||||
"tar-stream": "^1.5.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "decompress tar plugin",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"is-jpg": "^1.0.0",
|
||||
"pify": "^3.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/kevva/decompress-tar#readme",
|
||||
"keywords": [
|
||||
"decompress",
|
||||
"decompressplugin",
|
||||
"extract",
|
||||
"tar"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "decompress-tar",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kevva/decompress-tar.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "4.1.1"
|
||||
}
|
44
node_modules/decompress-tar/readme.md
generated
vendored
Normal file
44
node_modules/decompress-tar/readme.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# decompress-tar [](https://travis-ci.org/kevva/decompress-tar)
|
||||
|
||||
> tar decompress plugin
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install decompress-tar
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const decompress = require('decompress');
|
||||
const decompressTar = require('decompress-tar');
|
||||
|
||||
decompress('unicorn.tar', 'dist', {
|
||||
plugins: [
|
||||
decompressTar()
|
||||
]
|
||||
}).then(() => {
|
||||
console.log('Files decompressed');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### decompressTar()(input)
|
||||
|
||||
Returns both a Promise for a Buffer and a [Duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Buffer` `Stream`
|
||||
|
||||
Buffer or stream to decompress.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Mårtensson](https://github.com/kevva)
|
Reference in New Issue
Block a user