Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
- Loading branch information
Showing
27 changed files
with
1,277 additions
and
2,603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
declare module 'unzip2' { | ||
|
||
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; | ||
} | ||
} |
Oops, something went wrong.