diff --git a/types/tar-fs/index.d.ts b/types/tar-fs/index.d.ts index 09a645840b..daa885a4a2 100644 --- a/types/tar-fs/index.d.ts +++ b/types/tar-fs/index.d.ts @@ -1,15 +1,15 @@ // Type definitions for tar-fs 1.16 // Project: https://github.com/mafintosh/tar-fs // Definitions by: Umoxfo +// Chris Wiggins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 // Imported from: https://github.com/soywiz/typescript-node-definitions/d.ts /// -import fs = require('fs'); -import tarStream = require('tar-stream'); +import { ReadStream } from 'fs'; +import * as tarStream from 'tar-stream'; export function pack(cwd: string, opts?: PackOptions): tarStream.Pack; export function extract(cwd: string, opts?: ExtractOptions): tarStream.Extract; @@ -21,7 +21,7 @@ export interface Options { ignore?: (name: string) => boolean; filter?: (name: string) => boolean; map?: (header: Headers) => Headers; - mapStream?: (fileStream: fs.ReadStream, header: Headers) => fs.ReadStream; + mapStream?: (fileStream: ReadStream, header: Headers) => ReadStream; dmode?: number; fmode?: number; readable?: boolean; @@ -33,7 +33,8 @@ export interface PackOptions extends Options { entries?: string[]; dereference?: boolean; finalize?: boolean; - finish?: (pack: any) => void; + finish?: (pack: tarStream.Pack) => void; + pack?: tarStream.Pack; } export interface ExtractOptions extends Options { diff --git a/types/tar-fs/tar-fs-tests.ts b/types/tar-fs/tar-fs-tests.ts index 6acbdd4c75..1848cb6430 100644 --- a/types/tar-fs/tar-fs-tests.ts +++ b/types/tar-fs/tar-fs-tests.ts @@ -101,3 +101,15 @@ tar.pack('./my-directory', { */ tar.pack('./my-directory').entry({ name: 'generated-file.txt' }, '1234'); tar.pack('./my-directory').finalize(); + +/** + * Interact with tar-stream and do multiple packs + */ +tar.pack('./my-directory', { + finalize: false, + finish: (parentPack) => { + tar.pack('./other-directory', { + pack: parentPack + }); + } +});