mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add types of decompress (#20478)
This commit is contained in:
parent
4ec1572a3d
commit
28e995bbff
21
types/decompress/decompress-tests.ts
Normal file
21
types/decompress/decompress-tests.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import decompress = require('decompress');
|
||||
import * as path from "path";
|
||||
|
||||
decompress('unicorn.zip', 'dist').then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
|
||||
decompress('unicorn.zip', 'dist', {
|
||||
filter: file => path.extname(file.path) !== '.exe'
|
||||
}).then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
|
||||
decompress('unicorn.zip', 'dist', {
|
||||
map: file => {
|
||||
file.path = `unicorn-${file.path}`;
|
||||
return file;
|
||||
}
|
||||
}).then(files => {
|
||||
console.log('done!');
|
||||
});
|
||||
39
types/decompress/index.d.ts
vendored
Normal file
39
types/decompress/index.d.ts
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Type definitions for decompress 4.2
|
||||
// Project: https://github.com/kevva/decompress#readme
|
||||
// Definitions by: York Yao <https://github.com/plantain-00>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export = decompress;
|
||||
|
||||
declare function decompress(input: string | Buffer, output: string, opts?: Options): Promise<File>;
|
||||
|
||||
interface File {
|
||||
data: Buffer;
|
||||
mode: number;
|
||||
mtime: string;
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Filter out files before extracting
|
||||
*/
|
||||
filter?(file: File): boolean;
|
||||
/**
|
||||
* Map files before extracting
|
||||
*/
|
||||
map?(file: File): File;
|
||||
/**
|
||||
* Array of plugins to use.
|
||||
* Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* Remove leading directory components from extracted files.
|
||||
* Default: 0
|
||||
*/
|
||||
strip?: number;
|
||||
}
|
||||
23
types/decompress/tsconfig.json
Normal file
23
types/decompress/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"decompress-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/decompress/tslint.json
Normal file
1
types/decompress/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user