convert.d.ts
This file
Path
types/convert.d.ts
60 lines · 2.0 KiB · TypeScript
Last changed by
Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
Add `.js` to imports in types (#1033)ehmickybefore adoption3bdab60
lines 1–3why, one step back1import type {BinaryEncodingOption} from './arguments/encoding-option.js';2import type {Options} from './arguments/options.js';3import type {FromOption, ToOption} from './arguments/fd-options.js';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 4–52why, one step back45// `subprocess.readable|duplex|iterable()` options6export type ReadableOptions = {7 /**8 Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.910 `"all"` reads both `stdout` and `stderr`. This requires the `all` option to be `true`.1112 @default 'stdout'13 */14 readonly from?: FromOption;1516 /**17 If `false`, iterates over lines. Each line is a string.1819 If `true`, iterates over arbitrary chunks of data. Each line is an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) (with `subprocess.iterable()`) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (with `subprocess.readable()`/`subprocess.duplex()`).2021 This is always `true` when the `encoding` option is binary.2223 @default `false` with `subprocess.iterable()`, `true` otherwise24 */25 readonly binary?: boolean;2627 /**28 If both this option and the `binary` option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.2930 @default `false` with `subprocess.iterable()`, `true` otherwise31 */32 readonly preserveNewlines?: boolean;33};3435// `subprocess.writable|duplex()` options36export type WritableOptions = {37 /**38 Which stream to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.3940 @default 'stdin'41 */42 readonly to?: ToOption;43};4445// `subprocess.duplex()` options46export type DuplexOptions = ReadableOptions & WritableOptions;4748// `subprocess.iterable()` return value49export type SubprocessAsyncIterable<50 BinaryOption extends boolean | undefined,51 EncodingOption extends Options['encoding'],52> = AsyncIterableIterator<Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
line 53why, one step back53 EncodingOption extends BinaryEncodingOption100% test coverage (#1018)ehmickybefore adoption9f65b86
line 54why, one step back54 ? Uint8ArrayRequire Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
lines 55–57why, one step back55 : BinaryOption extends true56 ? Uint8Array57 : string100% test coverage (#1018)ehmickybefore adoption9f65b86
line 58why, one step back58>;Ensure all `d.ts` files are considered as ESM (#1216)Sindre Sorhusbefore adoption964f650
lines 59–60why, one step back5960export {};