api.md
This file
Path
docs/api.md
1,144 lines · 45.4 KiB · Markdown
Last changed by
Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6
History of this fileTake it
Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1–17why, one step back1<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 back18_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 19–28why, one step back1920Executes 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 back29_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 30–46why, one step back3031Executes 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\`46Rename some types (#1009)ehmickybefore adoption2ef9186
line 47why, one step back47_Returns_: [`SyncResult`](#return-value)Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 48why, one step back48Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 49–59why, one step back49Same 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 back60_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 61–74why, one step back6162Same 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 back75_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 76–85why, one step back7677Same 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)85Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3
line 86why, one step back86### parseCommandString(command)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 87–88why, one step back8788`command`: `string`\Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3
line 89why, one step back89_Returns_: `string[]`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 90why, one step back90Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3
line 91why, one step back91Split 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 back9293[More info.](escaping.md#user-defined-input)94Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 95–105why, one step back95### 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)105Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 106why, one step back106### getOneMessage(getOneMessageOptions?)Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 107why, one step back107Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 108why, one step back108_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 109–116why, one step back109_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)116Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
lines 117–128why, one step back117#### getOneMessageOptions118119_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)128Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 129–138why, one step back129### 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)138Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6
lines 139–150why, one step back139### exchangeMessage(message, getOneMessageOptions?)140141`message`: [`Message`](ipc.md#message-type)\142_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\143_Returns_: [`Promise<Message>`](ipc.md#message-type)144145Send a `message` to the parent process, then receive a response from it.146147This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.148149[More info.](ipc.md#exchanging-messages)150Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 151why, one step back151## Return valueMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 152why, one step back152Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
lines 153–154why, one step back153_TypeScript:_ [`ResultPromise`](typescript.md)\154_Type:_ `Promise<object> | Subprocess`Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 155why, one step back155Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 156why, one step back156The return value of all [asynchronous methods](#methods) is both:Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 157–158why, one step back157- the [subprocess](#subprocess).158- 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 159–161why, one step back159160[More info.](execution.md#subprocess)161Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 162–163why, one step back162## Subprocess163Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 164why, one step back164_TypeScript:_ [`Subprocess`](typescript.md)Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 165–167why, one step back165166[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.167Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 168–210why, one step back168### subprocess\[Symbol.asyncIterator\]()169170_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)171172Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.173174[More info.](lines.md#progressive-splitting)175176### subprocess.iterable(readableOptions?)177178`readableOptions`: [`ReadableOptions`](#readableoptions)\179_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)180181Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.182183[More info.](lines.md#progressive-splitting)184185### subprocess.pipe(file, arguments?, options?)186187`file`: `string | URL`\188`arguments`: `string[]`\189`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\190_Returns_: [`Promise<Result>`](#result)191192[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.193194This 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.195196[More info.](pipe.md#array-syntax)197198### subprocess.pipe\`command\`199### subprocess.pipe(options)\`command\`200201`command`: `string`\202`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\203_Returns_: [`Promise<Result>`](#result)204205Like [`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).206207[More info.](pipe.md#template-string-syntax)208209### subprocess.pipe(secondSubprocess, pipeOptions?)210Rename some types (#1009)ehmickybefore adoption2ef9186
line 211why, one step back211`secondSubprocess`: [`ResultPromise`](#return-value)\Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 212–214why, one step back212`pipeOptions`: [`PipeOptions`](#pipeoptions)\213_Returns_: [`Promise<Result>`](#result)214Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 215why, one step back215Like [`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 216–220why, one step back216217[More info.](pipe.md#advanced-syntax)218219#### pipeOptions220Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 221why, one step back221_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 222–224why, one step back222223#### pipeOptions.from224Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 225–226why, one step back225_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\226_Default:_ `"stdout"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 227–235why, one step back227228Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.229230`"all"` pipes both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.231232[More info.](pipe.md#source-file-descriptor)233234#### pipeOptions.to235Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 236–237why, one step back236_Type:_ `"stdin" | "fd3" | "fd4" | ...`\237_Default:_ `"stdin"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 238–244why, one step back238239Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.240241[More info.](pipe.md#destination-file-descriptor)242243#### pipeOptions.unpipeSignal244Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 245why, one step back245_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 246–257why, one step back246247Unpipe the subprocess when the signal aborts.248249[More info.](pipe.md#unpipe)250251### subprocess.kill(signal, error?)252### subprocess.kill(error?)253254`signal`: `string | number`\255`error`: `Error`\256_Returns_: `boolean`257Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 258why, one step back258Sends 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 259–267why, one step back259260This returns `false` when the signal could not be sent, for example when the subprocess has already exited.261262When 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).263264[More info.](termination.md)265266### subprocess.pid267Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 268why, one step back268_Type:_ `number | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 269–275why, one step back269270Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).271272This is `undefined` if the subprocess failed to spawn.273274[More info.](termination.md#inter-process-termination)275Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 276why, one step back276### subprocess.sendMessage(message)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 277why, one step back277Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 278–279why, one step back278`message`: [`Message`](ipc.md#message-type)\279_Returns_: `Promise<void>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 280why, one step back280Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 281why, one step back281Send a `message` to the subprocess.Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 282why, one step back282Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 283why, one step back283This 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 284–286why, one step back284285[More info.](ipc.md#exchanging-messages)286Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 287why, one step back287### subprocess.getOneMessage(getOneMessageOptions?)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 288why, one step back288Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 289why, one step back289_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 290why, one step back290_Returns_: [`Promise<Message>`](ipc.md#message-type)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 291why, one step back291Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 292why, one step back292Receive a single `message` from the subprocess.Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 293why, one step back293Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 294why, one step back294This 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 295–297why, one step back295296[More info.](ipc.md#exchanging-messages)297Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 298–307why, one step back298### subprocess.getEachMessage()299300_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)301302Iterate over each `message` from the subprocess.303304This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.305306[More info.](ipc.md#listening-to-messages)307Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6
lines 308–319why, one step back308### subprocess.exchangeMessage(message, getOneMessageOptions?)309310`message`: [`Message`](ipc.md#message-type)\311_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\312_Returns_: [`Promise<Message>`](ipc.md#message-type)313314Send a `message` to the subprocess, then receive a response from it.315316This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.317318[More info.](ipc.md#exchanging-messages)319Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 320–321why, one step back320### subprocess.stdin321Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 322why, one step back322_Type:_ [`Writable | null`](https://nodejs.org/api/stream.html#class-streamwritable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 323–331why, one step back323324The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.325326This 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).327328[More info.](streams.md#manual-streaming)329330### subprocess.stdout331Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 332why, one step back332_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 333–341why, one step back333334The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.335336This 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`.337338[More info.](streams.md#manual-streaming)339340### subprocess.stderr341Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 342why, one step back342_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 343–351why, one step back343344The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.345346This 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`.347348[More info.](streams.md#manual-streaming)349350### subprocess.all351Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 352why, one step back352_Type:_ [`Readable | undefined`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 353–363why, one step back353354Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).355356This requires the [`all`](#optionsall) option to be `true`.357358This 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`.359360More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).361362### subprocess.stdio363Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 364why, one step back364_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 365–382why, one step back365366The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.367368Each 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`.369370[More info.](streams.md#manual-streaming)371372### subprocess.readable(readableOptions?)373374`readableOptions`: [`ReadableOptions`](#readableoptions)\375_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream376377Converts the subprocess to a readable stream.378379[More info.](streams.md#converting-a-subprocess-to-a-stream)380381#### readableOptions382Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 383why, one step back383_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 384–386why, one step back384385#### readableOptions.from386Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 387–388why, one step back387_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\388_Default:_ `"stdout"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 389–397why, one step back389390Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.391392`"all"` reads both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.393394[More info.](streams.md#different-file-descriptor)395396#### readableOptions.binary397Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 398–399why, one step back398_Type:_ `boolean`\399_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 400–410why, one step back400401If `false`, iterates over lines. Each line is a string.402403If `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)).404405This is always `true` when the [`encoding`](#optionsencoding) option is binary.406407More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).408409#### readableOptions.preserveNewlines410Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 411–412why, one step back411_Type:_ `boolean`\412_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 413–428why, one step back413414If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.415416[More info.](lines.md#iterable)417418### subprocess.writable(writableOptions?)419420`writableOptions`: [`WritableOptions`](#writableoptions)\421_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream422423Converts the subprocess to a writable stream.424425[More info.](streams.md#converting-a-subprocess-to-a-stream)426427#### writableOptions428Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 429why, one step back429_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 430–432why, one step back430431#### writableOptions.to432Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 433–434why, one step back433_Type:_ `"stdin" | "fd3" | "fd4" | ...`\434_Default:_ `"stdin"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 435–450why, one step back435436Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.437438[More info.](streams.md#different-file-descriptor)439440### subprocess.duplex(duplexOptions?)441442`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\443_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream444445Converts the subprocess to a duplex stream.446447[More info.](streams.md#converting-a-subprocess-to-a-stream)448449## Result450Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 451why, one step back451_TypeScript:_ [`Result`](typescript.md) or [`SyncResult`](typescript.md\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 452why, one step back452_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 453why, one step back453Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 454why, one step back454[Result](execution.md#result) of a subprocess successful execution.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 455–459why, one step back455456When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.457458### result.stdout459Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 460why, one step back460_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 461–471why, one step back461462The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).463464This 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`.465466This 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).467468[More info.](output.md#stdout-and-stderr)469470### result.stderr471Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 472why, one step back472_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 473–483why, one step back473474The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).475476This 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`.477478This 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).479480[More info.](output.md#stdout-and-stderr)481482### result.all483Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 484why, one step back484_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 485–497why, one step back485486The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.487488This requires the [`all`](#optionsall) option to be `true`.489490This 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`.491492This 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).493494[More info.](output.md#interleaved-output)495496### result.stdio497Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 498why, one step back498_Type:_ `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 499–507why, one step back499500The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).501502Items 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`.503504Items are arrays when their corresponding `stdio` option is a [transform in object mode](transform.md#object-mode).505506[More info.](output.md#additional-file-descriptors)507Rename `result.ipc` to `result.ipcOutput` (#1075)ehmickybefore adoptionae9b360
line 508why, one step back508### result.ipcOutputAdd `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
line 509why, one step back509Fix type of `result.ipc` (#1071)ehmickybefore adoption69152ec
line 510why, one step back510_Type_: [`Message[]`](ipc.md#message-type)Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
lines 511–517why, one step back511512All the messages [sent by the subprocess](#sendmessagemessage) to the current process.513514This is empty unless the [`ipc`](#optionsipc) option is `true`. Also, this is empty if the [`buffer`](#optionsbuffer) option is `false`.515516[More info.](ipc.md#retrieve-all-messages)517Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 518–519why, one step back518### result.pipedFrom519Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 520why, one step back520_Type:_ [`Array<Result | ExecaError>`](#result)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 521–529why, one step back521522[Results](#result) of the other subprocesses that were piped into this subprocess.523524This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.525526[More info.](pipe.md#result)527528### result.command529Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 530why, one step back530_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 531–537why, one step back531532The file and [arguments](input.md#command-arguments) that were run.533534[More info.](debugging.md#command)535536### result.escapedCommand537Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 538why, one step back538_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 539–545why, one step back539540Same as [`command`](#resultcommand) but escaped.541542[More info.](debugging.md#command)543544### result.cwd545Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 546why, one step back546_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 547–553why, one step back547548The [current directory](#optionscwd) in which the command was run.549550[More info.](environment.md#current-directory)551552### result.durationMs553Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 554why, one step back554_Type:_ `number`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 555–561why, one step back555556Duration of the subprocess, in milliseconds.557558[More info.](debugging.md#duration)559560### result.failed561Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 562why, one step back562_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 563–565why, one step back563564Whether the subprocess failed to run.565Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 566–567why, one step back566When this is `true`, the result is an [`ExecaError`](#execaerror) instance with additional error-related properties.567Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 568–569why, one step back568[More info.](errors.md#subprocess-failure)569Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 570–571why, one step back570## ExecaError571## ExecaSyncErrorMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 572why, one step back572Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 573why, one step back573_Type:_ `Error`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 574–584why, one step back574575Result of a subprocess [failed execution](errors.md#subprocess-failure).576577This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.578579This has the same shape as [successful results](#result), with the following additional properties.580581[More info.](errors.md)582583### error.message584Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 585why, one step back585_Type:_ `string`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 586–592why, one step back586587Error message when the subprocess [failed](errors.md#subprocess-failure) to run.588589[More info.](errors.md#error-message)590591### error.shortMessage592Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 593why, one step back593_Type:_ `string`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 594–600why, one step back594595This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).596597[More info.](errors.md#error-message)598599### error.originalMessage600Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 601why, one step back601_Type:_ `string | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 602–608why, one step back602603Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.604605[More info.](errors.md#error-message)606607### error.cause608Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 609why, one step back609_Type:_ `unknown | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 610–618why, one step back610611Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).612613This is usually an `Error` instance.614615[More info.](termination.md#error-message-and-stack-trace)616617### error.code618Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 619why, one step back619_Type:_ `string | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 620–624why, one step back620621Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.622623### error.timedOut624Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 625why, one step back625_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 626–630why, one step back626627Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.628629[More info.](termination.md#timeout)630Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 631why, one step back631### error.isCanceledMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 632why, one step back632Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 633why, one step back633_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 634–638why, one step back634635Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.636637[More info.](termination.md#canceling)638Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 639why, one step back639### error.isMaxBufferMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 640why, one step back640Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 641why, one step back641_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 642–646why, one step back642643Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.644645[More info.](output.md#big-output)646Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 647why, one step back647### error.isTerminatedMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 648why, one step back648Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 649why, one step back649_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 650–656why, one step back650651Whether the subprocess was terminated by a [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) sent by either:652- The current process.653- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).654655[More info.](termination.md#signal-name-and-description)656Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 657why, one step back657### error.exitCodeMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 658why, one step back658Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 659why, one step back659_Type:_ `number | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 660–662why, one step back660661The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.662Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 663why, one step back663This 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 664–666why, one step back664665[More info.](errors.md#exit-code)666Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 667why, one step back667### error.signalMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 668why, one step back668Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 669why, one step back669_Type:_ `string | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 670–678why, one step back670671The name of the [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) that terminated the subprocess, sent by either:672- The current process.673- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).674675If a signal terminated the subprocess, this property is defined and included in the [error message](#errormessage). Otherwise it is `undefined`.676677[More info.](termination.md#signal-name-and-description)678Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 679why, one step back679### error.signalDescriptionMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 680why, one step back680Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 681why, one step back681_Type:_ `string | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 682–690why, one step back682683A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.684685If 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.686687[More info.](termination.md#signal-name-and-description)688689## Options690Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 691why, one step back691_TypeScript:_ [`Options`](typescript.md) or [`SyncOptions`](typescript.md\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 692why, one step back692_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 693–699why, one step back693694This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).695696The 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).697698### options.preferLocal699Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 700–701why, one step back700_Type:_ `boolean`\701_Default:_ `true` with [`$`](#file-arguments-options), `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 702–708why, one step back702703Prefer locally installed binaries when looking for a binary to execute.704705[More info.](environment.md#local-binaries)706707### options.localDir708Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 709–710why, one step back709_Type:_ `string | URL`\710_Default:_ [`cwd`](#optionscwd) optionMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 711–717why, one step back711712Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.713714[More info.](environment.md#local-binaries)715716### options.node717Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 718–719why, one step back718_Type:_ `boolean`\719_Default:_ `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 720–722why, one step back720721If `true`, runs with Node.js. The first argument must be a Node.js file.722Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5
lines 723–724why, one step back723The 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.724Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 725–728why, one step back725[More info.](node.md)726727### options.nodeOptions728Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 729why, one step back729_Type:_ `string[]`\Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5
line 730why, one step back730_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 731–739why, one step back731732List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).733734Requires the [`node`](#optionsnode) option to be `true`.735736[More info.](node.md#nodejs-cli-flags)737738### options.nodePath739Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 740–741why, one step back740_Type:_ `string | URL`\741_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 742–750why, one step back742743Path to the Node.js executable.744745Requires the [`node`](#optionsnode) option to be `true`.746747[More info.](node.md#nodejs-version)748749### options.shell750Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 751–752why, one step back751_Type:_ `boolean | string | URL`\752_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 753–763why, one step back753754If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).755756Uses [`/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.757758We [recommend against](shell.md#avoiding-shells) using this option.759760[More info.](shell.md)761762### options.cwd763Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 764–765why, one step back764_Type:_ `string | URL`\765_Default:_ `process.cwd()`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 766–774why, one step back766767Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.768769This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.770771[More info.](environment.md#current-directory)772773### options.env774Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 775–776why, one step back775_Type:_ `object`\776_Default:_ [`process.env`](https://nodejs.org/api/process.html#processenv)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 777–785why, one step back777778[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).779780Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).781782[More info.](input.md#environment-variables)783784### options.extendEnv785Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 786–787why, one step back786_Type:_ `boolean`\787_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 788–795why, one step back788789If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).790If `false`, only the `env` option is used, not `process.env`.791792[More info.](input.md#environment-variables)793794### options.input795Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 796why, one step back796_Type:_ `string | Uint8Array | stream.Readable`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 797–805why, one step back797798Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).799800See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.801802[More info.](input.md#string-input)803804### options.inputFile805Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 806why, one step back806_Type:_ `string | URL`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 807–815why, one step back807808Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).809810See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.811812[More info.](input.md#file-input)813814### options.stdin815Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 816why, one step back816_TypeScript:_ [`StdinOption`](typescript.md) or [`StdinSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 817–818why, one step back817_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)\818_Default:_ `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 819–827why, one step back819820How 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).821822This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.823824More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).825826### options.stdout827Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 828why, one step back828_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 829–830why, one step back829_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)\830_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 831–839why, one step back831832How 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).833834This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.835836More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).837838### options.stderr839Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 840why, one step back840_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 841–842why, one step back841_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)\842_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 843–851why, one step back843844How 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).845846This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.847848More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).849850### options.stdio851Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 852why, one step back852_TypeScript:_ [`Options['stdio']`](typescript.md) or [`SyncOptions['stdio']`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 853–854why, one step back853_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)\854_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 855–865why, one step back855856Like 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'}`.857858A single string can be used [as a shortcut](output.md#shortcut).859860The array can have more than 3 items, to create [additional file descriptors](output.md#additional-file-descriptors) beyond [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr).861862More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).863864### options.all865Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 866–867why, one step back866_Type:_ `boolean`\867_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 868–874why, one step back868869Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.870871[More info.](output.md#interleaved-output)872873### options.encoding874Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 875–876why, one step back875_Type:_ `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\876_Default:_ `'utf8'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 877–889why, one step back877878If 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).879880If it outputs binary data instead, this should be either:881- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).882- [`'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.883884The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).885886[More info.](binary.md)887888### options.lines889Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 890–891why, one step back890_Type:_ `boolean`\891_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 892–902why, one step back892893Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.894895This cannot be used if the [`encoding`](#optionsencoding) option is [binary](binary.md#binary-output).896897By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).898899[More info.](lines.md#simple-splitting)900901### options.stripFinalNewline902Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 903–904why, one step back903_Type:_ `boolean`\904_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 905–915why, one step back905906Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.907908If the [`lines`](#optionslines) option is true, this applies to each output line instead.909910By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).911912[More info.](lines.md#newlines)913914### options.maxBuffer915Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 916–917why, one step back916_Type:_ `number`\917_Default:_ `100_000_000`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 918–926why, one step back918919Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).920921By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).922923[More info.](output.md#big-output)924925### options.buffer926Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 927–928why, one step back927_Type:_ `boolean`\928_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 929–937why, one step back929930When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.931932By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).933934[More info.](output.md#low-memory)935936### options.ipc937Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 938why, one step back938_Type:_ `boolean`\Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
line 939why, one step back939_Default:_ `true` if either the [`node`](#optionsnode) option or the [`ipcInput`](#optionsipcinput) is set, `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 940why, one step back940Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6
line 941why, one step back941Enables exchanging messages with the subprocess using [`subprocess.sendMessage(message)`](#subprocesssendmessagemessage), [`subprocess.getOneMessage()`](#subprocessgetonemessagegetonemessageoptions), [`subprocess.exchangeMessage(message)`](#subprocessexchangemessagemessage-getonemessageoptions) and [`subprocess.getEachMessage()`](#subprocessgeteachmessage).Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 942why, one step back942Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 943–944why, one step back943The subprocess must be a Node.js file.944Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 945–948why, one step back945[More info.](ipc.md)946947### options.serialization948Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 949–950why, one step back949_Type:_ `'json' | 'advanced'`\950_Default:_ `'advanced'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 951–954why, one step back951952Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option.953954[More info.](ipc.md#message-type)Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 955–964why, one step back955956### options.ipcInput957958_Type_: [`Message`](ipc.md#message-type)959960Sends an IPC message when the subprocess starts.961962The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.963964More 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 965–967why, one step back965966### options.verbose967Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 968–969why, one step back968_Type:_ `'none' | 'short' | 'full'`\969_Default:_ `'none'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 970–972why, one step back970971If `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.972Log IPC messages with `verbose: 'full'` (#1063)ehmickybefore adoption839c2fe
line 973why, one step back973If `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 974–980why, one step back974975By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).976977[More info.](debugging.md#verbose-mode)978979### options.reject980Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 981–982why, one step back981_Type:_ `boolean`\982_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 983why, one step back983Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 984why, one step back984Setting 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 985–989why, one step back985986[More info.](errors.md#preventing-exceptions)987988### options.timeout989Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 990–991why, one step back990_Type:_ `number`\991_Default:_ `0`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 992–994why, one step back992993If `timeout` is greater than `0`, the subprocess will be [terminated](#optionskillsignal) if it runs for longer than that amount of milliseconds.994Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 995why, one step back995On timeout, [`result.timedOut`](#errortimedout) becomes `true`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 996–1000why, one step back996997[More info.](termination.md#timeout)998999### options.cancelSignal1000Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1001why, one step back1001_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1002–1004why, one step back10021003You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).1004Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 1005why, one step back1005When `AbortController.abort()` is called, [`result.isCanceled`](#erroriscanceled) becomes `true`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1006–1010why, one step back10061007[More info.](termination.md#canceling)10081009### options.forceKillAfterDelay1010Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1011–1012why, one step back1011_Type:_ `number | false`\1012_Default:_ `5000`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1013–1019why, one step back10131014If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).10151016[More info.](termination.md#forceful-termination)10171018### options.killSignal1019Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1020–1021why, one step back1020_Type:_ `string | number`\1021_Default:_ `'SIGTERM'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1022–1030why, one step back10221023Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10241025This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10261027[More info.](termination.md#default-signal)10281029### options.detached1030Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1031–1032why, one step back1031_Type:_ `boolean`\1032_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1033–1039why, one step back10331034Run the subprocess independently from the current process.10351036[More info.](environment.md#background-subprocess)10371038### options.cleanup1039Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1040–1041why, one step back1040_Type:_ `boolean`\1041_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1042–1048why, one step back10421043Kill the subprocess when the current process exits.10441045[More info.](termination.md#current-process-exit)10461047### options.uid1048Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1049–1050why, one step back1049_Type:_ `number`\1050_Default:_ current user identifierMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1051–1057why, one step back10511052Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10531054[More info.](windows.md#uid-and-gid)10551056### options.gid1057Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1058–1059why, one step back1058_Type:_ `number`\1059_Default:_ current group identifierMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1060–1066why, one step back10601061Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.10621063[More info.](windows.md#uid-and-gid)10641065### options.argv01066Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1067–1068why, one step back1067_Type:_ `string`\1068_Default:_ file being executedMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1069–1073why, one step back10691070Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10711072### options.windowsHide1073Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1074–1075why, one step back1074_Type:_ `boolean`\1075_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1076–1082why, one step back10761077On Windows, do not create a new console window.10781079[More info.](windows.md#console-window)10801081### options.windowsVerbatimArguments1082Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1083–1084why, one step back1083_Type:_ `boolean`\1084_Default:_ `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1085–1099why, one step back10851086If `false`, escapes the command arguments on Windows.10871088[More info.](windows.md#cmdexe-escaping)10891090## Transform options10911092A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.10931094A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.10951096[More info.](transform.md)10971098### transformOptions.transform1099Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1100why, one step back1100_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1101–1107why, one step back11011102Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.11031104More info [here](transform.md#summary) and [there](transform.md#sharing-state).11051106### transformOptions.final1107Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1108why, one step back1108_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1109–1115why, one step back11091110Create additional lines after the last one.11111112[More info.](transform.md#finalizing)11131114### transformOptions.binary1115Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1116–1117why, one step back1116_Type:_ `boolean`\1117_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1118–1124why, one step back11181119If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.11201121[More info.](binary.md#transforms)11221123### transformOptions.preserveNewlines1124Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1125–1126why, one step back1125_Type:_ `boolean`\1126_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1127–1133why, one step back11271128If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11291130[More info.](lines.md#transforms)11311132### transformOptions.objectMode1133Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1134–1135why, one step back1134_Type:_ `boolean`\1135_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1136–1144why, one step back11361137If `true`, allow [`transformOptions.transform`](#transformoptionstransform) and [`transformOptions.final`](#transformoptionsfinal) to return any type, not just `string` or `Uint8Array`.11381139[More info.](transform.md#object-mode)11401141<hr>11421143[**Previous**: 🔍 Differences with Bash and zx](bash.md)\1144[**Top**: Table of contents](../readme.md#documentation)