UNPKG

@types/unzip

Version:
50 lines (41 loc) 1.49 kB
# Installation > `npm install --save @types/unzip` # Summary This package contains type definitions for unzip (https://github.com/EvanOxfeld/node-unzip). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unzip. ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unzip/index.d.ts) ````ts /// <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; } ```` ### Additional Details * Last updated: Tue, 07 Nov 2023 15:11:36 GMT * Dependencies: [@types/node](https://npmjs.com/package/@types/node) # Credits These definitions were written by [Ravi L.](https://github.com/coding2012).