mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-16 15:46:00 +00:00
fix
This commit is contained in:
96
node_modules/decompress/index.js
generated
vendored
Normal file
96
node_modules/decompress/index.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const fs = require('graceful-fs');
|
||||
const decompressTar = require('decompress-tar');
|
||||
const decompressTarbz2 = require('decompress-tarbz2');
|
||||
const decompressTargz = require('decompress-targz');
|
||||
const decompressUnzip = require('decompress-unzip');
|
||||
const makeDir = require('make-dir');
|
||||
const pify = require('pify');
|
||||
const stripDirs = require('strip-dirs');
|
||||
|
||||
const fsP = pify(fs);
|
||||
|
||||
const runPlugins = (input, opts) => {
|
||||
if (opts.plugins.length === 0) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
return Promise.all(opts.plugins.map(x => x(input, opts))).then(files => files.reduce((a, b) => a.concat(b)));
|
||||
};
|
||||
|
||||
const extractFile = (input, output, opts) => runPlugins(input, opts).then(files => {
|
||||
if (opts.strip > 0) {
|
||||
files = files
|
||||
.map(x => {
|
||||
x.path = stripDirs(x.path, opts.strip);
|
||||
return x;
|
||||
})
|
||||
.filter(x => x.path !== '.');
|
||||
}
|
||||
|
||||
if (typeof opts.filter === 'function') {
|
||||
files = files.filter(opts.filter);
|
||||
}
|
||||
|
||||
if (typeof opts.map === 'function') {
|
||||
files = files.map(opts.map);
|
||||
}
|
||||
|
||||
if (!output) {
|
||||
return files;
|
||||
}
|
||||
|
||||
return Promise.all(files.map(x => {
|
||||
const dest = path.join(output, x.path);
|
||||
const mode = x.mode & ~process.umask();
|
||||
const now = new Date();
|
||||
|
||||
if (x.type === 'directory') {
|
||||
return makeDir(dest)
|
||||
.then(() => fsP.utimes(dest, now, x.mtime))
|
||||
.then(() => x);
|
||||
}
|
||||
|
||||
return makeDir(path.dirname(dest))
|
||||
.then(() => {
|
||||
if (x.type === 'link') {
|
||||
return fsP.link(x.linkname, dest);
|
||||
}
|
||||
|
||||
if (x.type === 'symlink' && process.platform === 'win32') {
|
||||
return fsP.link(x.linkname, dest);
|
||||
}
|
||||
|
||||
if (x.type === 'symlink') {
|
||||
return fsP.symlink(x.linkname, dest);
|
||||
}
|
||||
|
||||
return fsP.writeFile(dest, x.data, {mode});
|
||||
})
|
||||
.then(() => x.type === 'file' && fsP.utimes(dest, now, x.mtime))
|
||||
.then(() => x);
|
||||
}));
|
||||
});
|
||||
|
||||
module.exports = (input, output, opts) => {
|
||||
if (typeof input !== 'string' && !Buffer.isBuffer(input)) {
|
||||
return Promise.reject(new TypeError('Input file required'));
|
||||
}
|
||||
|
||||
if (typeof output === 'object') {
|
||||
opts = output;
|
||||
output = null;
|
||||
}
|
||||
|
||||
opts = Object.assign({plugins: [
|
||||
decompressTar(),
|
||||
decompressTarbz2(),
|
||||
decompressTargz(),
|
||||
decompressUnzip()
|
||||
]}, opts);
|
||||
|
||||
const read = typeof input === 'string' ? fsP.readFile(input) : Promise.resolve(input);
|
||||
|
||||
return read.then(buf => extractFile(buf, output, opts));
|
||||
};
|
21
node_modules/decompress/license
generated
vendored
Normal file
21
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.
|
81
node_modules/decompress/package.json
generated
vendored
Normal file
81
node_modules/decompress/package.json
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"_from": "decompress@^4.2.0",
|
||||
"_id": "decompress@4.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=",
|
||||
"_location": "/decompress",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "decompress@^4.2.0",
|
||||
"name": "decompress",
|
||||
"escapedName": "decompress",
|
||||
"rawSpec": "^4.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/ffmpeg-binaries"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.0.tgz",
|
||||
"_shasum": "7aedd85427e5a92dacfe55674a7c505e96d01f9d",
|
||||
"_spec": "decompress@^4.2.0",
|
||||
"_where": "C:\\Users\\matia\\Musix\\node_modules\\ffmpeg-binaries",
|
||||
"author": {
|
||||
"name": "Kevin Mårtensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kevva/decompress/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"decompress-tar": "^4.0.0",
|
||||
"decompress-tarbz2": "^4.0.0",
|
||||
"decompress-targz": "^4.0.0",
|
||||
"decompress-unzip": "^4.0.1",
|
||||
"graceful-fs": "^4.1.10",
|
||||
"make-dir": "^1.0.0",
|
||||
"pify": "^2.3.0",
|
||||
"strip-dirs": "^2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Extracting archives made easy",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"is-jpg": "^1.0.0",
|
||||
"path-exists": "^3.0.0",
|
||||
"pify": "^2.3.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"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": "4.2.0"
|
||||
}
|
103
node_modules/decompress/readme.md
generated
vendored
Normal file
103
node_modules/decompress/readme.md
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
# 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');
|
||||
|
||||
decompress('unicorn.zip', 'dist').then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### decompress(input, [output], [options])
|
||||
|
||||
Returns a Promise for an array of files in the following format:
|
||||
|
||||
```js
|
||||
{
|
||||
data: Buffer,
|
||||
mode: Number,
|
||||
mtime: String,
|
||||
path: String,
|
||||
type: String
|
||||
}
|
||||
```
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string` `Buffer`
|
||||
|
||||
File to decompress.
|
||||
|
||||
#### output
|
||||
|
||||
Type: `string`
|
||||
|
||||
Output directory.
|
||||
|
||||
#### options
|
||||
|
||||
##### filter
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Filter out files before extracting. E.g:
|
||||
|
||||
```js
|
||||
decompress('unicorn.zip', 'dist', {
|
||||
filter: file => path.extname(file.path) !== '.exe'
|
||||
}).then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
```
|
||||
|
||||
##### map
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Map files before extracting: E.g:
|
||||
|
||||
```js
|
||||
decompress('unicorn.zip', 'dist', {
|
||||
map: file => {
|
||||
file.path = `unicorn-${file.path}`;
|
||||
return file;
|
||||
}
|
||||
}).then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
```
|
||||
|
||||
##### plugins
|
||||
|
||||
Type: `Array`<br>
|
||||
Default: `[decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]`
|
||||
|
||||
Array of [plugins](https://www.npmjs.com/browse/keyword/decompressplugin) to use.
|
||||
|
||||
##### strip
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `0`
|
||||
|
||||
Remove leading directory components from extracted files.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Mårtensson](https://github.com/kevva)
|
Reference in New Issue
Block a user