Skip to content
Myr

api.md

This file

Path

docs/api.md

1,120 lines · 44.3 KiB · Markdown

Last changed by

Debounce `message` events (#1087)ehmickybefore adoptione8bab97

History of this file

Take it

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1–17why, one step back
1<picture>
2 <source media="(prefers-color-scheme: dark)" srcset="../media/logo_dark.svg">3 <img alt="execa logo" src="../media/logo.svg" width="400">4</picture>5<br>67# 📔 API reference89This lists all available [methods](#methods) and their [options](#options). This also describes the properties of the [subprocess](#subprocess), [result](#result) and [error](#execaerror) they return.1011## Methods1213### execa(file, arguments?, options?)1415`file`: `string | URL`\16`arguments`: `string[]`\17`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 18why, one step back
18_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 19–28why, one step back
19
20Executes a command using `file ...arguments`.2122More info on the [syntax](execution.md#array-syntax) and [escaping](escaping.md#array-syntax).2324### execa\`command\`25### execa(options)\`command\`2627`command`: `string`\28`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 29why, one step back
29_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 30–46why, one step back
30
31Executes a command. `command` is a [template string](execution.md#template-string-syntax) that includes both the `file` and its `arguments`.3233More info on the [syntax](execution.md#template-string-syntax) and [escaping](escaping.md#template-string-syntax).3435### execa(options)3637`options`: [`Options`](#options)\38_Returns_: [`execa`](#execafile-arguments-options)3940Returns a new instance of Execa but with different default [`options`](#options). Consecutive calls are merged to previous ones.4142[More info.](execution.md#globalshared-options)4344### execaSync(file, arguments?, options?)45### execaSync\`command\`46

Rename some types (#1009)ehmickybefore adoption2ef9186

line 47why, one step back
47_Returns_: [`SyncResult`](#return-value)

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 48why, one step back
48

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 49–59why, one step back
49Same as [`execa()`](#execafile-arguments-options) but synchronous.
5051Returns or throws a subprocess [`result`](#result). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.5253[More info.](execution.md#synchronous-execution)5455### $(file, arguments?, options?)5657`file`: `string | URL`\58`arguments`: `string[]`\59`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 60why, one step back
60_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 61–74why, one step back
61
62Same as [`execa()`](#execafile-arguments-options) but using [script-friendly default options](scripts.md#script-files).6364Just like `execa()`, this can use the [template string syntax](execution.md#template-string-syntax) or [bind options](execution.md#globalshared-options). It can also be [run synchronously](#execasyncfile-arguments-options) using `$.sync()` or `$.s()`.6566This is the preferred method when executing multiple commands in a script file.6768[More info.](scripts.md)6970### execaNode(scriptPath, arguments?, options?)7172`scriptPath`: `string | URL`\73`arguments`: `string[]`\74`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 75why, one step back
75_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 76–85why, one step back
76
77Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#optionsnode) option.78Executes a Node.js file using `node scriptPath ...arguments`.7980Just like `execa()`, this can use the [template string syntax](execution.md#template-string-syntax) or [bind options](execution.md#globalshared-options).8182This is the preferred method when executing Node.js files.8384[More info.](node.md)85

Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3

line 86why, one step back
86### parseCommandString(command)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 87–88why, one step back
87
88`command`: `string`\

Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3

line 89why, one step back
89_Returns_: `string[]`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 90why, one step back
90

Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3

line 91why, one step back
91Split a `command` string into an array. For example, `'npm run build'` returns `['npm', 'run', 'build']` and `'argument otherArgument'` returns `['argument', 'otherArgument']`.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 92–94why, one step back
92
93[More info.](escaping.md#user-defined-input)94

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 95–105why, one step back
95### sendMessage(message)
9697`message`: [`Message`](ipc.md#message-type)\98_Returns_: `Promise<void>`99100Send a `message` to the parent process.101102This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.103104[More info.](ipc.md#exchanging-messages)105

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 106why, one step back
106### getOneMessage(getOneMessageOptions?)

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 107why, one step back
107

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 108why, one step back
108_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 109–116why, one step back
109_Returns_: [`Promise<Message>`](ipc.md#message-type)
110111Receive a single `message` from the parent process.112113This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.114115[More info.](ipc.md#exchanging-messages)116

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

lines 117–128why, one step back
117#### getOneMessageOptions
118119_Type_: `object`120121#### getOneMessageOptions.filter122123_Type_: [`(Message) => boolean`](ipc.md#message-type)124125Ignore any `message` that returns `false`.126127[More info.](ipc.md#filter-messages)128

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 129–138why, one step back
129### getEachMessage()
130131_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)132133Iterate over each `message` from the parent process.134135This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.136137[More info.](ipc.md#listening-to-messages)138

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 139why, one step back
139## Return value

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 140why, one step back
140

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

lines 141–142why, one step back
141_TypeScript:_ [`ResultPromise`](typescript.md)\
142_Type:_ `Promise<object> | Subprocess`

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 143why, one step back
143

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 144why, one step back
144The return value of all [asynchronous methods](#methods) is both:

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 145–146why, one step back
145- the [subprocess](#subprocess).
146- a `Promise` either resolving with its successful [`result`](#result), or rejecting with its [`error`](#execaerror).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 147–149why, one step back
147
148[More info.](execution.md#subprocess)149

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 150–151why, one step back
150## Subprocess
151

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 152why, one step back
152_TypeScript:_ [`Subprocess`](typescript.md)

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 153–155why, one step back
153
154[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.155

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 156–198why, one step back
156### subprocess\[Symbol.asyncIterator\]()
157158_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)159160Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.161162[More info.](lines.md#progressive-splitting)163164### subprocess.iterable(readableOptions?)165166`readableOptions`: [`ReadableOptions`](#readableoptions)\167_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)168169Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.170171[More info.](lines.md#progressive-splitting)172173### subprocess.pipe(file, arguments?, options?)174175`file`: `string | URL`\176`arguments`: `string[]`\177`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\178_Returns_: [`Promise<Result>`](#result)179180[Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the subprocess' [`stdout`](#subprocessstdout) to a second Execa subprocess' [`stdin`](#subprocessstdin). This resolves with that second subprocess' [result](#result). If either subprocess is rejected, this is rejected with that subprocess' [error](#execaerror) instead.181182This follows the same syntax as [`execa(file, arguments?, options?)`](#execafile-arguments-options) except both [regular options](#options) and [pipe-specific options](#pipeoptions) can be specified.183184[More info.](pipe.md#array-syntax)185186### subprocess.pipe\`command\`187### subprocess.pipe(options)\`command\`188189`command`: `string`\190`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\191_Returns_: [`Promise<Result>`](#result)192193Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using a [`command` template string](scripts.md#piping-stdout-to-another-command) instead. This follows the same syntax as `execa` [template strings](execution.md#template-string-syntax).194195[More info.](pipe.md#template-string-syntax)196197### subprocess.pipe(secondSubprocess, pipeOptions?)198

Rename some types (#1009)ehmickybefore adoption2ef9186

line 199why, one step back
199`secondSubprocess`: [`ResultPromise`](#return-value)\

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 200–202why, one step back
200`pipeOptions`: [`PipeOptions`](#pipeoptions)\
201_Returns_: [`Promise<Result>`](#result)202

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 203why, one step back
203Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using the [return value](#return-value) of another [`execa()`](#execafile-arguments-options) call instead.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 204–208why, one step back
204
205[More info.](pipe.md#advanced-syntax)206207#### pipeOptions208

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 209why, one step back
209_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 210–212why, one step back
210
211#### pipeOptions.from212

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 213–214why, one step back
213_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\
214_Default:_ `"stdout"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 215–223why, one step back
215
216Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.217218`"all"` pipes both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.219220[More info.](pipe.md#source-file-descriptor)221222#### pipeOptions.to223

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 224–225why, one step back
224_Type:_ `"stdin" | "fd3" | "fd4" | ...`\
225_Default:_ `"stdin"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 226–232why, one step back
226
227Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.228229[More info.](pipe.md#destination-file-descriptor)230231#### pipeOptions.unpipeSignal232

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 233why, one step back
233_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 234–245why, one step back
234
235Unpipe the subprocess when the signal aborts.236237[More info.](pipe.md#unpipe)238239### subprocess.kill(signal, error?)240### subprocess.kill(error?)241242`signal`: `string | number`\243`error`: `Error`\244_Returns_: `boolean`245

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 246why, one step back
246Sends a [signal](https://nodejs.org/api/os.html#signal-constants) to the subprocess. The default signal is the [`killSignal`](#optionskillsignal) option. `killSignal` defaults to `SIGTERM`, which [terminates](#erroristerminated) the subprocess.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 247–255why, one step back
247
248This returns `false` when the signal could not be sent, for example when the subprocess has already exited.249250When an error is passed as argument, it is set to the subprocess' [`error.cause`](#errorcause). The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).251252[More info.](termination.md)253254### subprocess.pid255

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 256why, one step back
256_Type:_ `number | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 257–263why, one step back
257
258Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).259260This is `undefined` if the subprocess failed to spawn.261262[More info.](termination.md#inter-process-termination)263

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 264why, one step back
264### subprocess.sendMessage(message)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 265why, one step back
265

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 266–267why, one step back
266`message`: [`Message`](ipc.md#message-type)\
267_Returns_: `Promise<void>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 268why, one step back
268

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 269why, one step back
269Send a `message` to the subprocess.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 270why, one step back
270

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 271why, one step back
271This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 272–274why, one step back
272
273[More info.](ipc.md#exchanging-messages)274

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 275why, one step back
275### subprocess.getOneMessage(getOneMessageOptions?)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 276why, one step back
276

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 277why, one step back
277_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 278why, one step back
278_Returns_: [`Promise<Message>`](ipc.md#message-type)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 279why, one step back
279

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 280why, one step back
280Receive a single `message` from the subprocess.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 281why, one step back
281

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 282why, one step back
282This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 283–285why, one step back
283
284[More info.](ipc.md#exchanging-messages)285

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 286–295why, one step back
286### subprocess.getEachMessage()
287288_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)289290Iterate over each `message` from the subprocess.291292This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.293294[More info.](ipc.md#listening-to-messages)295

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 296–297why, one step back
296### subprocess.stdin
297

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 298why, one step back
298_Type:_ [`Writable | null`](https://nodejs.org/api/stream.html#class-streamwritable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 299–307why, one step back
299
300The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.301302This is `null` if the [`stdin`](#optionsstdin) option is set to [`'inherit'`](input.md#terminal-input), [`'ignore'`](input.md#ignore-input), [`Readable`](streams.md#input) or [`integer`](input.md#terminal-input).303304[More info.](streams.md#manual-streaming)305306### subprocess.stdout307

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 308why, one step back
308_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 309–317why, one step back
309
310The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.311312This is `null` if the [`stdout`](#optionsstdout) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.313314[More info.](streams.md#manual-streaming)315316### subprocess.stderr317

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 318why, one step back
318_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 319–327why, one step back
319
320The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.321322This is `null` if the [`stderr`](#optionsstdout) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.323324[More info.](streams.md#manual-streaming)325326### subprocess.all327

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 328why, one step back
328_Type:_ [`Readable | undefined`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 329–339why, one step back
329
330Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).331332This requires the [`all`](#optionsall) option to be `true`.333334This is `undefined` if [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options are set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.335336More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).337338### subprocess.stdio339

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 340why, one step back
340_Type:_ [`[Writable | null, Readable | null, Readable | null, ...Array<Writable | Readable | null>]`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 341–358why, one step back
341
342The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.343344Each array item is `null` if the corresponding [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Stream`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.345346[More info.](streams.md#manual-streaming)347348### subprocess.readable(readableOptions?)349350`readableOptions`: [`ReadableOptions`](#readableoptions)\351_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream352353Converts the subprocess to a readable stream.354355[More info.](streams.md#converting-a-subprocess-to-a-stream)356357#### readableOptions358

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 359why, one step back
359_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 360–362why, one step back
360
361#### readableOptions.from362

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 363–364why, one step back
363_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\
364_Default:_ `"stdout"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 365–373why, one step back
365
366Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.367368`"all"` reads both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.369370[More info.](streams.md#different-file-descriptor)371372#### readableOptions.binary373

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 374–375why, one step back
374_Type:_ `boolean`\
375_Default:_ `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 376–386why, one step back
376
377If `false`, iterates over lines. Each line is a string.378379If `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()`](#subprocessiterablereadableoptions)) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)).380381This is always `true` when the [`encoding`](#optionsencoding) option is binary.382383More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).384385#### readableOptions.preserveNewlines386

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 387–388why, one step back
387_Type:_ `boolean`\
388_Default:_ `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 389–404why, one step back
389
390If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.391392[More info.](lines.md#iterable)393394### subprocess.writable(writableOptions?)395396`writableOptions`: [`WritableOptions`](#writableoptions)\397_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream398399Converts the subprocess to a writable stream.400401[More info.](streams.md#converting-a-subprocess-to-a-stream)402403#### writableOptions404

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 405why, one step back
405_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 406–408why, one step back
406
407#### writableOptions.to408

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 409–410why, one step back
409_Type:_ `"stdin" | "fd3" | "fd4" | ...`\
410_Default:_ `"stdin"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 411–426why, one step back
411
412Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.413414[More info.](streams.md#different-file-descriptor)415416### subprocess.duplex(duplexOptions?)417418`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\419_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream420421Converts the subprocess to a duplex stream.422423[More info.](streams.md#converting-a-subprocess-to-a-stream)424425## Result426

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 427why, one step back
427_TypeScript:_ [`Result`](typescript.md) or [`SyncResult`](typescript.md\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 428why, one step back
428_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 429why, one step back
429

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 430why, one step back
430[Result](execution.md#result) of a subprocess successful execution.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 431–435why, one step back
431
432When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.433434### result.stdout435

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 436why, one step back
436_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 437–447why, one step back
437
438The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).439440This is `undefined` if the [`stdout`](#optionsstdout) option is set to only [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.441442This is an array if the [`lines`](#optionslines) option is `true`, or if the `stdout` option is a [transform in object mode](transform.md#object-mode).443444[More info.](output.md#stdout-and-stderr)445446### result.stderr447

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 448why, one step back
448_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 449–459why, one step back
449
450The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).451452This is `undefined` if the [`stderr`](#optionsstderr) option is set to only [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.453454This is an array if the [`lines`](#optionslines) option is `true`, or if the `stderr` option is a [transform in object mode](transform.md#object-mode).455456[More info.](output.md#stdout-and-stderr)457458### result.all459

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 460why, one step back
460_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 461–473why, one step back
461
462The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.463464This requires the [`all`](#optionsall) option to be `true`.465466This is `undefined` if both [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options are set to only [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.467468This is an array if the [`lines`](#optionslines) option is `true`, or if either the `stdout` or `stderr` option is a [transform in object mode](transform.md#object-mode).469470[More info.](output.md#interleaved-output)471472### result.stdio473

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 474why, one step back
474_Type:_ `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 475–483why, one step back
475
476The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).477478Items are `undefined` when their corresponding [`stdio`](#optionsstdio) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.479480Items are arrays when their corresponding `stdio` option is a [transform in object mode](transform.md#object-mode).481482[More info.](output.md#additional-file-descriptors)483

Rename `result.ipc` to `result.ipcOutput` (#1075)ehmickybefore adoptionae9b360

line 484why, one step back
484### result.ipcOutput

Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de

line 485why, one step back
485

Fix type of `result.ipc` (#1071)ehmickybefore adoption69152ec

line 486why, one step back
486_Type_: [`Message[]`](ipc.md#message-type)

Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de

lines 487–493why, one step back
487
488All the messages [sent by the subprocess](#sendmessagemessage) to the current process.489490This is empty unless the [`ipc`](#optionsipc) option is `true`. Also, this is empty if the [`buffer`](#optionsbuffer) option is `false`.491492[More info.](ipc.md#retrieve-all-messages)493

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 494–495why, one step back
494### result.pipedFrom
495

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 496why, one step back
496_Type:_ [`Array<Result | ExecaError>`](#result)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 497–505why, one step back
497
498[Results](#result) of the other subprocesses that were piped into this subprocess.499500This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.501502[More info.](pipe.md#result)503504### result.command505

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 506why, one step back
506_Type:_ `string`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 507–513why, one step back
507
508The file and [arguments](input.md#command-arguments) that were run.509510[More info.](debugging.md#command)511512### result.escapedCommand513

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 514why, one step back
514_Type:_ `string`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 515–521why, one step back
515
516Same as [`command`](#resultcommand) but escaped.517518[More info.](debugging.md#command)519520### result.cwd521

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 522why, one step back
522_Type:_ `string`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 523–529why, one step back
523
524The [current directory](#optionscwd) in which the command was run.525526[More info.](environment.md#current-directory)527528### result.durationMs529

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 530why, one step back
530_Type:_ `number`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 531–537why, one step back
531
532Duration of the subprocess, in milliseconds.533534[More info.](debugging.md#duration)535536### result.failed537

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 538why, one step back
538_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 539–541why, one step back
539
540Whether the subprocess failed to run.541

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 542–543why, one step back
542When this is `true`, the result is an [`ExecaError`](#execaerror) instance with additional error-related properties.
543

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 544–545why, one step back
544[More info.](errors.md#subprocess-failure)
545

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 546–547why, one step back
546## ExecaError
547## ExecaSyncError

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 548why, one step back
548

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 549why, one step back
549_Type:_ `Error`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 550–560why, one step back
550
551Result of a subprocess [failed execution](errors.md#subprocess-failure).552553This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.554555This has the same shape as [successful results](#result), with the following additional properties.556557[More info.](errors.md)558559### error.message560

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 561why, one step back
561_Type:_ `string`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 562–568why, one step back
562
563Error message when the subprocess [failed](errors.md#subprocess-failure) to run.564565[More info.](errors.md#error-message)566567### error.shortMessage568

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 569why, one step back
569_Type:_ `string`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 570–576why, one step back
570
571This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).572573[More info.](errors.md#error-message)574575### error.originalMessage576

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 577why, one step back
577_Type:_ `string | undefined`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 578–584why, one step back
578
579Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.580581[More info.](errors.md#error-message)582583### error.cause584

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 585why, one step back
585_Type:_ `unknown | undefined`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 586–594why, one step back
586
587Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).588589This is usually an `Error` instance.590591[More info.](termination.md#error-message-and-stack-trace)592593### error.code594

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 595why, one step back
595_Type:_ `string | undefined`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 596–600why, one step back
596
597Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.598599### error.timedOut600

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 601why, one step back
601_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 602–606why, one step back
602
603Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.604605[More info.](termination.md#timeout)606

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 607why, one step back
607### error.isCanceled

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 608why, one step back
608

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 609why, one step back
609_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 610–614why, one step back
610
611Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.612613[More info.](termination.md#canceling)614

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 615why, one step back
615### error.isMaxBuffer

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 616why, one step back
616

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 617why, one step back
617_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 618–622why, one step back
618
619Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.620621[More info.](output.md#big-output)622

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 623why, one step back
623### error.isTerminated

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 624why, one step back
624

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 625why, one step back
625_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 626–632why, one step back
626
627Whether the subprocess was terminated by a [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) sent by either:628- The current process.629- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).630631[More info.](termination.md#signal-name-and-description)632

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 633why, one step back
633### error.exitCode

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 634why, one step back
634

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 635why, one step back
635_Type:_ `number | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 636–638why, one step back
636
637The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.638

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 639why, one step back
639This is `undefined` when the subprocess could not be spawned or was terminated by a [signal](#errorsignal).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 640–642why, one step back
640
641[More info.](errors.md#exit-code)642

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 643why, one step back
643### error.signal

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 644why, one step back
644

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 645why, one step back
645_Type:_ `string | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 646–654why, one step back
646
647The name of the [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) that terminated the subprocess, sent by either:648- The current process.649- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).650651If a signal terminated the subprocess, this property is defined and included in the [error message](#errormessage). Otherwise it is `undefined`.652653[More info.](termination.md#signal-name-and-description)654

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 655why, one step back
655### error.signalDescription

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 656why, one step back
656

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 657why, one step back
657_Type:_ `string | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 658–666why, one step back
658
659A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.660661If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.662663[More info.](termination.md#signal-name-and-description)664665## Options666

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 667why, one step back
667_TypeScript:_ [`Options`](typescript.md) or [`SyncOptions`](typescript.md\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 668why, one step back
668_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 669–675why, one step back
669
670This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).671672The following options [can specify different values](output.md#stdoutstderr-specific-options) for [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr): [`verbose`](#optionsverbose), [`lines`](#optionslines), [`stripFinalNewline`](#optionsstripfinalnewline), [`buffer`](#optionsbuffer), [`maxBuffer`](#optionsmaxbuffer).673674### options.preferLocal675

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 676–677why, one step back
676_Type:_ `boolean`\
677_Default:_ `true` with [`$`](#file-arguments-options), `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 678–684why, one step back
678
679Prefer locally installed binaries when looking for a binary to execute.680681[More info.](environment.md#local-binaries)682683### options.localDir684

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 685–686why, one step back
685_Type:_ `string | URL`\
686_Default:_ [`cwd`](#optionscwd) option

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 687–693why, one step back
687
688Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.689690[More info.](environment.md#local-binaries)691692### options.node693

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 694–695why, one step back
694_Type:_ `boolean`\
695_Default:_ `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 696–698why, one step back
696
697If `true`, runs with Node.js. The first argument must be a Node.js file.698

Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5

lines 699–700why, one step back
699The subprocess inherits the current Node.js [CLI flags](https://nodejs.org/api/cli.html#options) and version. This can be overridden using the [`nodeOptions`](#optionsnodeoptions) and [`nodePath`](#optionsnodepath) options.
700

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 701–704why, one step back
701[More info.](node.md)
702703### options.nodeOptions704

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 705why, one step back
705_Type:_ `string[]`\

Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5

line 706why, one step back
706_Default:_ [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI flags)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 707–715why, one step back
707
708List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).709710Requires the [`node`](#optionsnode) option to be `true`.711712[More info.](node.md#nodejs-cli-flags)713714### options.nodePath715

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 716–717why, one step back
716_Type:_ `string | URL`\
717_Default:_ [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 718–726why, one step back
718
719Path to the Node.js executable.720721Requires the [`node`](#optionsnode) option to be `true`.722723[More info.](node.md#nodejs-version)724725### options.shell726

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 727–728why, one step back
727_Type:_ `boolean | string | URL`\
728_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 729–739why, one step back
729
730If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).731732Uses [`/bin/sh`](https://en.wikipedia.org/wiki/Unix_shell) on UNIX and [`cmd.exe`](https://en.wikipedia.org/wiki/Cmd.exe) on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.733734We [recommend against](shell.md#avoiding-shells) using this option.735736[More info.](shell.md)737738### options.cwd739

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 740–741why, one step back
740_Type:_ `string | URL`\
741_Default:_ `process.cwd()`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 742–750why, one step back
742
743Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.744745This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.746747[More info.](environment.md#current-directory)748749### options.env750

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 751–752why, one step back
751_Type:_ `object`\
752_Default:_ [`process.env`](https://nodejs.org/api/process.html#processenv)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 753–761why, one step back
753
754[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).755756Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).757758[More info.](input.md#environment-variables)759760### options.extendEnv761

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 762–763why, one step back
762_Type:_ `boolean`\
763_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 764–771why, one step back
764
765If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).766If `false`, only the `env` option is used, not `process.env`.767768[More info.](input.md#environment-variables)769770### options.input771

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 772why, one step back
772_Type:_ `string | Uint8Array | stream.Readable`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 773–781why, one step back
773
774Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).775776See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.777778[More info.](input.md#string-input)779780### options.inputFile781

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 782why, one step back
782_Type:_ `string | URL`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 783–791why, one step back
783
784Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).785786See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.787788[More info.](input.md#file-input)789790### options.stdin791

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 792why, one step back
792_TypeScript:_ [`StdinOption`](typescript.md) or [`StdinSyncOption`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 793–794why, one step back
793_Type:_ `string | number | stream.Readable | ReadableStream | TransformStream | URL | {file: string} | Uint8Array | Iterable<string | Uint8Array | unknown> | AsyncIterable<string | Uint8Array | unknown> | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}` (or a tuple of those types)\
794_Default:_ `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 795–803why, one step back
795
796How to setup the subprocess' [standard input](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be [`'pipe'`](streams.md#manual-streaming), [`'overlapped'`](windows.md#asynchronous-io), [`'ignore`](input.md#ignore-input), [`'inherit'`](input.md#terminal-input), a [file descriptor integer](input.md#terminal-input), a [Node.js `Readable` stream](streams.md#input), a web [`ReadableStream`](streams.md#web-streams), a [`{ file: 'path' }` object](input.md#file-input), a [file URL](input.md#file-input), an [`Iterable`](streams.md#iterables-as-input) (including an [array of strings](input.md#string-input)), an [`AsyncIterable`](streams.md#iterables-as-input), an [`Uint8Array`](binary.md#binary-input), a [generator function](transform.md), a [`Duplex`](transform.md#duplextransform-streams) or a web [`TransformStream`](transform.md#duplextransform-streams).797798This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.799800More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).801802### options.stdout803

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 804why, one step back
804_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 805–806why, one step back
805_Type:_ `string | number | stream.Writable | WritableStream | TransformStream | URL | {file: string} | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}` (or a tuple of those types)\
806_Default:_ `pipe`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 807–815why, one step back
807
808How to setup the subprocess' [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be [`'pipe'`](output.md#stdout-and-stderr), [`'overlapped'`](windows.md#asynchronous-io), [`'ignore`](output.md#ignore-output), [`'inherit'`](output.md#terminal-output), a [file descriptor integer](output.md#terminal-output), a [Node.js `Writable` stream](streams.md#output), a web [`WritableStream`](streams.md#web-streams), a [`{ file: 'path' }` object](output.md#file-output), a [file URL](output.md#file-output), a [generator function](transform.md), a [`Duplex`](transform.md#duplextransform-streams) or a web [`TransformStream`](transform.md#duplextransform-streams).809810This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.811812More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).813814### options.stderr815

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 816why, one step back
816_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 817–818why, one step back
817_Type:_ `string | number | stream.Writable | WritableStream | TransformStream | URL | {file: string} | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}` (or a tuple of those types)\
818_Default:_ `pipe`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 819–827why, one step back
819
820How to setup the subprocess' [standard error](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be [`'pipe'`](output.md#stdout-and-stderr), [`'overlapped'`](windows.md#asynchronous-io), [`'ignore`](output.md#ignore-output), [`'inherit'`](output.md#terminal-output), a [file descriptor integer](output.md#terminal-output), a [Node.js `Writable` stream](streams.md#output), a web [`WritableStream`](streams.md#web-streams), a [`{ file: 'path' }` object](output.md#file-output), a [file URL](output.md#file-output), a [generator function](transform.md), a [`Duplex`](transform.md#duplextransform-streams) or a web [`TransformStream`](transform.md#duplextransform-streams).821822This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.823824More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).825826### options.stdio827

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 828why, one step back
828_TypeScript:_ [`Options['stdio']`](typescript.md) or [`SyncOptions['stdio']`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 829–830why, one step back
829_Type:_ `string | Array<string | number | stream.Readable | stream.Writable | ReadableStream | WritableStream | TransformStream | URL | {file: string} | Uint8Array | Iterable<string> | Iterable<Uint8Array> | Iterable<unknown> | AsyncIterable<string | Uint8Array | unknown> | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}>` (or a tuple of those types)\
830_Default:_ `pipe`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 831–841why, one step back
831
832Like the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options but for all [file descriptors](https://en.wikipedia.org/wiki/File_descriptor) at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.833834A single string can be used [as a shortcut](output.md#shortcut).835836The array can have more than 3 items, to create [additional file descriptors](output.md#additional-file-descriptors) beyond [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr).837838More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).839840### options.all841

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 842–843why, one step back
842_Type:_ `boolean`\
843_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 844–850why, one step back
844
845Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.846847[More info.](output.md#interleaved-output)848849### options.encoding850

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 851–852why, one step back
851_Type:_ `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\
852_Default:_ `'utf8'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 853–865why, one step back
853
854If the subprocess outputs text, specifies its character encoding, either [`'utf8'`](https://en.wikipedia.org/wiki/UTF-8) or [`'utf16le'`](https://en.wikipedia.org/wiki/UTF-16).855856If it outputs binary data instead, this should be either:857- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).858- [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#URL_applications), [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.859860The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).861862[More info.](binary.md)863864### options.lines865

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 866–867why, one step back
866_Type:_ `boolean`\
867_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 868–878why, one step back
868
869Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.870871This cannot be used if the [`encoding`](#optionsencoding) option is [binary](binary.md#binary-output).872873By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).874875[More info.](lines.md#simple-splitting)876877### options.stripFinalNewline878

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 879–880why, one step back
879_Type:_ `boolean`\
880_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 881–891why, one step back
881
882Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.883884If the [`lines`](#optionslines) option is true, this applies to each output line instead.885886By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).887888[More info.](lines.md#newlines)889890### options.maxBuffer891

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 892–893why, one step back
892_Type:_ `number`\
893_Default:_ `100_000_000`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 894–902why, one step back
894
895Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).896897By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).898899[More info.](output.md#big-output)900901### options.buffer902

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 903–904why, one step back
903_Type:_ `boolean`\
904_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 905–913why, one step back
905
906When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.907908By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).909910[More info.](output.md#low-memory)911912### options.ipc913

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 914why, one step back
914_Type:_ `boolean`\

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

line 915why, one step back
915_Default:_ `true` if either the [`node`](#optionsnode) option or the [`ipcInput`](#optionsipcinput) is set, `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 916why, one step back
916

Debounce `message` events (#1087)ehmickybefore adoptione8bab97

line 917why, one step back
917Enables exchanging messages with the subprocess using [`subprocess.sendMessage(message)`](#subprocesssendmessagemessage), [`subprocess.getOneMessage()`](#subprocessgetonemessagegetonemessageoptions) and [`subprocess.getEachMessage()`](#subprocessgeteachmessage).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 918why, one step back
918

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 919–920why, one step back
919The subprocess must be a Node.js file.
920

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 921–924why, one step back
921[More info.](ipc.md)
922923### options.serialization924

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 925–926why, one step back
925_Type:_ `'json' | 'advanced'`\
926_Default:_ `'advanced'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 927–930why, one step back
927
928Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option.929930[More info.](ipc.md#message-type)

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 931–940why, one step back
931
932### options.ipcInput933934_Type_: [`Message`](ipc.md#message-type)935936Sends an IPC message when the subprocess starts.937938The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.939940More info [here](ipc.md#send-an-initial-message) and [there](input.md#any-input-type).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 941–943why, one step back
941
942### options.verbose943

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 944–945why, one step back
944_Type:_ `'none' | 'short' | 'full'`\
945_Default:_ `'none'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 946–948why, one step back
946
947If `verbose` is `'short'`, prints the command on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)): its file, arguments, duration and (if it failed) error message.948

Log IPC messages with `verbose: 'full'` (#1063)ehmickybefore adoption839c2fe

line 949why, one step back
949If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)), `stderr` and [IPC messages](ipc.md) are also printed.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 950–956why, one step back
950
951By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).952953[More info.](debugging.md#verbose-mode)954955### options.reject956

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 957–958why, one step back
957_Type:_ `boolean`\
958_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 959why, one step back
959

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 960why, one step back
960Setting this to `false` resolves the [result's promise](#return-value) with the [error](#execaerror) instead of rejecting it.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 961–965why, one step back
961
962[More info.](errors.md#preventing-exceptions)963964### options.timeout965

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 966–967why, one step back
966_Type:_ `number`\
967_Default:_ `0`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 968–970why, one step back
968
969If `timeout` is greater than `0`, the subprocess will be [terminated](#optionskillsignal) if it runs for longer than that amount of milliseconds.970

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 971why, one step back
971On timeout, [`result.timedOut`](#errortimedout) becomes `true`.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 972–976why, one step back
972
973[More info.](termination.md#timeout)974975### options.cancelSignal976

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 977why, one step back
977_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 978–980why, one step back
978
979You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).980

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 981why, one step back
981When `AbortController.abort()` is called, [`result.isCanceled`](#erroriscanceled) becomes `true`.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 982–986why, one step back
982
983[More info.](termination.md#canceling)984985### options.forceKillAfterDelay986

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 987–988why, one step back
987_Type:_ `number | false`\
988_Default:_ `5000`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 989–995why, one step back
989
990If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).991992[More info.](termination.md#forceful-termination)993994### options.killSignal995

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 996–997why, one step back
996_Type:_ `string | number`\
997_Default:_ `'SIGTERM'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 998–1006why, one step back
998
999Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10001001This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10021003[More info.](termination.md#default-signal)10041005### options.detached1006

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1007–1008why, one step back
1007_Type:_ `boolean`\
1008_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1009–1015why, one step back
1009
1010Run the subprocess independently from the current process.10111012[More info.](environment.md#background-subprocess)10131014### options.cleanup1015

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1016–1017why, one step back
1016_Type:_ `boolean`\
1017_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1018–1024why, one step back
1018
1019Kill the subprocess when the current process exits.10201021[More info.](termination.md#current-process-exit)10221023### options.uid1024

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1025–1026why, one step back
1025_Type:_ `number`\
1026_Default:_ current user identifier

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1027–1033why, one step back
1027
1028Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10291030[More info.](windows.md#uid-and-gid)10311032### options.gid1033

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1034–1035why, one step back
1034_Type:_ `number`\
1035_Default:_ current group identifier

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1036–1042why, one step back
1036
1037Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.10381039[More info.](windows.md#uid-and-gid)10401041### options.argv01042

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1043–1044why, one step back
1043_Type:_ `string`\
1044_Default:_ file being executed

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1045–1049why, one step back
1045
1046Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10471048### options.windowsHide1049

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1050–1051why, one step back
1050_Type:_ `boolean`\
1051_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1052–1058why, one step back
1052
1053On Windows, do not create a new console window.10541055[More info.](windows.md#console-window)10561057### options.windowsVerbatimArguments1058

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1059–1060why, one step back
1059_Type:_ `boolean`\
1060_Default:_ `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1061–1075why, one step back
1061
1062If `false`, escapes the command arguments on Windows.10631064[More info.](windows.md#cmdexe-escaping)10651066## Transform options10671068A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.10691070A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.10711072[More info.](transform.md)10731074### transformOptions.transform1075

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 1076why, one step back
1076_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1077–1083why, one step back
1077
1078Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.10791080More info [here](transform.md#summary) and [there](transform.md#sharing-state).10811082### transformOptions.final1083

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 1084why, one step back
1084_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1085–1091why, one step back
1085
1086Create additional lines after the last one.10871088[More info.](transform.md#finalizing)10891090### transformOptions.binary1091

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1092–1093why, one step back
1092_Type:_ `boolean`\
1093_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1094–1100why, one step back
1094
1095If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.10961097[More info.](binary.md#transforms)10981099### transformOptions.preserveNewlines1100

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1101–1102why, one step back
1101_Type:_ `boolean`\
1102_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1103–1109why, one step back
1103
1104If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11051106[More info.](lines.md#transforms)11071108### transformOptions.objectMode1109

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1110–1111why, one step back
1110_Type:_ `boolean`\
1111_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1112–1120why, one step back
1112
1113If `true`, allow [`transformOptions.transform`](#transformoptionstransform) and [`transformOptions.final`](#transformoptionsfinal) to return any type, not just `string` or `Uint8Array`.11141115[More info.](transform.md#object-mode)11161117<hr>11181119[**Previous**: 🔍 Differences with Bash and zx](bash.md)\1120[**Top**: Table of contents](../readme.md#documentation)