333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Type definitions for unzip 0.1
// Project: https://github.com/EvanOxfeld/node-unzip
// Definitions by: Ravi L. <https://github.com/coding2012>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
 
import stream = require('stream');
 
export function Extract(options: { path: string }): NodeJS.WritableStream;
export function Parse(): NodeJS.WritableStream;
 
/**
 * Code example from https://www.npmjs.com/package/unzip with type unzip.Entry added
 * ```
 * fs.createReadStream('path/to/archive.zip')
 *  .pipe(unzip.Parse())
 *  .on('entry', function (entry: unzip.Entry) {
 *    var fileName = entry.path;
 *    var type = entry.type; // 'Directory' or 'File'
 *    var size = entry.size;
 *    if (fileName === "this IS the file I'm looking for") {
 *      entry.pipe(fs.createWriteStream('output/path'));
 *    } else {
 *      entry.autodrain();
 *    }
 *  });
 * ```
 */
export interface Entry extends stream.PassThrough {
    path: string;
    type: 'Directory' | 'File';
    size: number;
    autodrain: () => void;
}