mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Updates tar-fs to include pack option (#42813)
* Updates tar-fs to include pack option * Switch away from require * Remove explicit typescript version
This commit is contained in:
parent
5ed9dc7696
commit
cbeb5ba463
11
types/tar-fs/index.d.ts
vendored
11
types/tar-fs/index.d.ts
vendored
@ -1,15 +1,15 @@
|
||||
// Type definitions for tar-fs 1.16
|
||||
// Project: https://github.com/mafintosh/tar-fs
|
||||
// Definitions by: Umoxfo <https://github.com/Umoxfo>
|
||||
// Chris Wiggins <https://github.com/chriswiggins>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/d.ts
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
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 {
|
||||
|
||||
@ -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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user