mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
fix(node): backport stream.finished options since v10 (#43959)
This commit is contained in:
Vendored
+7
-1
@@ -244,9 +244,15 @@ declare module "stream" {
|
||||
|
||||
class PassThrough extends Transform { }
|
||||
|
||||
interface FinishedOptions {
|
||||
error?: boolean;
|
||||
readable?: boolean;
|
||||
writable?: boolean;
|
||||
}
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
namespace finished {
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise<void>;
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
|
||||
}
|
||||
|
||||
function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
|
||||
|
||||
Vendored
+7
-1
@@ -246,9 +246,15 @@ declare module "stream" {
|
||||
|
||||
class PassThrough extends Transform { }
|
||||
|
||||
interface FinishedOptions {
|
||||
error?: boolean;
|
||||
readable?: boolean;
|
||||
writable?: boolean;
|
||||
}
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
namespace finished {
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise<void>;
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
|
||||
}
|
||||
|
||||
function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
|
||||
|
||||
@@ -159,7 +159,10 @@ function simplified_stream_ctor_test() {
|
||||
}
|
||||
|
||||
function streamPipelineFinished() {
|
||||
const cancel = finished(process.stdin, (err?: Error | null) => {});
|
||||
let cancel = finished(process.stdin, (err?: Error | null) => {});
|
||||
cancel();
|
||||
|
||||
cancel = finished(process.stdin, { readable: false }, (err?: Error | null) => {});
|
||||
cancel();
|
||||
|
||||
pipeline(process.stdin, process.stdout, (err?: Error | null) => {});
|
||||
@@ -168,6 +171,7 @@ function streamPipelineFinished() {
|
||||
async function asyncStreamPipelineFinished() {
|
||||
const fin = promisify(finished);
|
||||
await fin(process.stdin);
|
||||
await fin(process.stdin, { readable: false });
|
||||
|
||||
const pipe = promisify(pipeline);
|
||||
await pipe(process.stdin, process.stdout);
|
||||
|
||||
Vendored
+7
-1
@@ -262,9 +262,15 @@ declare module "stream" {
|
||||
|
||||
class PassThrough extends Transform { }
|
||||
|
||||
interface FinishedOptions {
|
||||
error?: boolean;
|
||||
readable?: boolean;
|
||||
writable?: boolean;
|
||||
}
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
|
||||
namespace finished {
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise<void>;
|
||||
function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
|
||||
}
|
||||
|
||||
function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
|
||||
|
||||
@@ -163,7 +163,10 @@ function simplified_stream_ctor_test() {
|
||||
}
|
||||
|
||||
function streamPipelineFinished() {
|
||||
const cancel = finished(process.stdin, (err?: Error | null) => {});
|
||||
let cancel = finished(process.stdin, (err?: Error | null) => {});
|
||||
cancel();
|
||||
|
||||
cancel = finished(process.stdin, { readable: false }, (err?: Error | null) => {});
|
||||
cancel();
|
||||
|
||||
pipeline(process.stdin, process.stdout, (err?: Error | null) => {});
|
||||
@@ -172,6 +175,7 @@ function streamPipelineFinished() {
|
||||
async function asyncStreamPipelineFinished() {
|
||||
const fin = promisify(finished);
|
||||
await fin(process.stdin);
|
||||
await fin(process.stdin, { readable: false });
|
||||
|
||||
const pipe = promisify(pipeline);
|
||||
await pipe(process.stdin, process.stdout);
|
||||
|
||||
Reference in New Issue
Block a user