Use types from tar-stream as return types of tar-fs (#41282)

* Use types from tar-stream as return types of tar-fs

* Re-export tar-stream types
This commit is contained in:
Matthew Turner
2020-01-09 08:09:27 +11:00
committed by Armando Aguirre
parent 88dc14e78f
commit 4878ac3f21
2 changed files with 12 additions and 5 deletions

View File

@@ -9,11 +9,13 @@
/// <reference types="node" />
import fs = require('fs');
import stream = require('stream');
import tarStream = require('tar-stream');
// Replace these return values with the value of tar-stream when it becomes available
export function pack(cwd: string, opts?: PackOptions): stream.Readable;
export function extract(cwd: string, opts?: ExtractOptions): stream.Writable;
export function pack(cwd: string, opts?: PackOptions): tarStream.Pack;
export function extract(cwd: string, opts?: ExtractOptions): tarStream.Extract;
export type Pack = tarStream.Pack;
export type Extract = tarStream.Extract;
export interface Options {
ignore?: (name: string) => boolean;

View File

@@ -1,7 +1,6 @@
import tar = require("tar-fs");
import fs = require("fs");
import path = require("path");
import stream = require("stream");
/*
* Default test
@@ -96,3 +95,9 @@ tar.pack('./my-directory', {
strict: false,
dereference: true,
});
/*
* Return type of tar-stream
*/
tar.pack('./my-directory').entry({ name: 'generated-file.txt' }, '1234');
tar.pack('./my-directory').finalize();