UNPKG

from-node-stream

Version:
70 lines (69 loc) 3.2 kB
import { Readable, Writable } from "stream"; import { fromReadable } from "./fromReadable"; import { fromWritable } from "./fromWritable"; /** * Creates a TransformStream from a process's stdio, dropping stderr output * @template IN - Input data type (string or Uint8Array) * @template OUT - Output data type (string or Uint8Array) * @param p - A process object with stdin, stdout, and stderr streams * @returns A TransformStream that connects stdin to stdout, ignoring stderr */ export declare function fromStdioDropErr<IN extends string | Uint8Array, OUT extends string | Uint8Array>( /** a process, which has stdin, stdout, stderr */ p: { stdin?: Writable | null; stdout?: Readable | null; stderr?: Readable | null; }): TransformStream<IN, OUT>; /** * Creates a TransformStream from a process's stdio, merging stdout and stderr * @template IN - Input data type (string or Uint8Array) * @template OUT - Output data type (string or Uint8Array) * @param p - A process object with stdin, stdout, and stderr streams * @returns A TransformStream that connects stdin to a merged stdout+stderr stream */ export declare function fromStdioMergeError<IN extends string | Uint8Array, OUT extends string | Uint8Array>( /** a process, which has stdin, stdout, stderr */ p: { stdin?: Writable | null; stdout?: Readable | null; stderr?: Readable | null; }): TransformStream<IN, OUT>; /** * Creates a TransformStream from a process's stdio, forwarding stderr to a specified stream * @template IN - Input data type (string or Uint8Array) * @template OUT - Output data type (string or Uint8Array) * @param p - A process object with stdin, stdout, and stderr streams * @param options - Configuration object * @param options.stderr - The writable stream to forward stderr to * @returns A TransformStream that connects stdin to stdout, forwarding stderr separately */ export declare function fromStdioAndForwardError<IN extends string | Uint8Array, OUT extends string | Uint8Array>( /** a process, which has stdin, stdout, stderr */ p: { stdin?: Writable | null; stdout?: Readable | null; stderr?: Readable | null; }, { stderr }: { stderr: Writable; }): TransformStream<IN, OUT>; /** * Creates a TransformStream from a process's stdio with configurable stderr handling * @template IN - Input data type (string or Uint8Array) * @template OUT - Output data type (string or Uint8Array) * @param p - A process object with stdin, stdout, and stderr streams * @param options - Configuration object for stderr handling * @param options.stderr - Writable stream to forward stderr to, or null to drop stderr, or undefined to merge with stdout * @returns A TransformStream that connects stdin to stdout with the specified stderr behavior */ export declare function fromStdio<IN extends string | Uint8Array, OUT extends string | Uint8Array>( /** a process, which has stdin, stdout, stderr */ p: { stdin?: Writable | null; stdout?: Readable | null; stderr?: Readable | null; }, { stderr, }?: { /** specify stderr to forward, or set to null to drop. */ stderr?: Writable | null; }): TransformStream<IN, OUT>; export { fromReadable, fromWritable };