pipe.d.ts
This file
Path
types/pipe.d.ts
58 lines · 2.4 KiB · TypeScript
Last changed by
Add `.js` to imports in types (#1033)ehmickybefore adoption3bdab60
History of this fileTake it
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859import type {Options} from './arguments/options.js';import type {Result} from './return/result.js';import type {FromOption, ToOption} from './arguments/fd-options.js';import type {ResultPromise} from './subprocess/subprocess.js';import type {TemplateExpression} from './methods/template.js';
// `subprocess.pipe()` optionstype PipeOptions = { /** Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.
`"all"` pipes both `stdout` and `stderr`. This requires the `all` option to be `true`. */ readonly from?: FromOption;
/** Which stream to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed. */ readonly to?: ToOption;
/** Unpipe the subprocess when the signal aborts. */ readonly unpipeSignal?: AbortSignal;};
// `subprocess.pipe()`export type PipableSubprocess = { /** [Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the subprocess' `stdout` to a second Execa subprocess' `stdin`. This resolves with that second subprocess' result. If either subprocess is rejected, this is rejected with that subprocess' error instead.
This follows the same syntax as `execa(file, arguments?, options?)` except both regular options and pipe-specific options can be specified. */ pipe<OptionsType extends Options & PipeOptions = {}>( file: string | URL, arguments?: readonly string[], options?: OptionsType, ): Promise<Result<OptionsType>> & PipableSubprocess; pipe<OptionsType extends Options & PipeOptions = {}>( file: string | URL, options?: OptionsType, ): Promise<Result<OptionsType>> & PipableSubprocess;
/** Like `subprocess.pipe(file, arguments?, options?)` but using a `command` template string instead. This follows the same syntax as `$`. */ pipe(templates: TemplateStringsArray, ...expressions: readonly TemplateExpression[]): Promise<Result<{}>> & PipableSubprocess; pipe<OptionsType extends Options & PipeOptions = {}>(options: OptionsType): (templates: TemplateStringsArray, ...expressions: readonly TemplateExpression[]) => Promise<Result<OptionsType>> & PipableSubprocess;
/** Like `subprocess.pipe(file, arguments?, options?)` but using the return value of another `execa()` call instead. */ pipe<Destination extends ResultPromise>(destination: Destination, options?: PipeOptions): Promise<Awaited<Destination>> & PipableSubprocess;};