api.md
This file
Path
docs/api.md
1,135 lines · 44.7 KiB · Markdown
Last changed by
Improve documentation of signal handling (#1105)ehmickybefore adoption01a4b42
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 `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 95why, one step back95### sendMessage(message, sendMessageOptions?)Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 96–97why, one step back9697`message`: [`Message`](ipc.md#message-type)\Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 98why, one step back98`sendMessageOptions`: [`SendMessageOptions`](#sendmessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 99–106why, one step back99_Returns_: `Promise<void>`100101Send a `message` to the parent process.102103This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.104105[More info.](ipc.md#exchanging-messages)106Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
lines 107–119why, one step back107#### sendMessageOptions108109_Type_: `object`110111#### sendMessageOptions.strict112113_Type_: `boolean`\114_Default_: `false`115116Throw when the other process is not receiving or listening to messages.117118[More info.](ipc.md#ensure-messages-are-received)119Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 120why, one step back120### getOneMessage(getOneMessageOptions?)Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 121why, one step back121Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 122why, one step back122`getOneMessageOptions`: [`GetOneMessageOptions`](#getonemessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 123–130why, one step back123_Returns_: [`Promise<Message>`](ipc.md#message-type)124125Receive a single `message` from the parent process.126127This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.128129[More info.](ipc.md#exchanging-messages)130Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
lines 131–142why, one step back131#### getOneMessageOptions132133_Type_: `object`134135#### getOneMessageOptions.filter136137_Type_: [`(Message) => boolean`](ipc.md#message-type)138139Ignore any `message` that returns `false`.140141[More info.](ipc.md#filter-messages)142Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 143–152why, one step back143### getEachMessage()144145_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)146147Iterate over each `message` from the parent process.148149This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.150151[More info.](ipc.md#listening-to-messages)152Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 153why, one step back153## Return valueMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 154why, one step back154Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
lines 155–156why, one step back155_TypeScript:_ [`ResultPromise`](typescript.md)\156_Type:_ `Promise<object> | Subprocess`Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 157why, one step back157Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 158why, one step back158The return value of all [asynchronous methods](#methods) is both:Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 159–160why, one step back159- the [subprocess](#subprocess).160- 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 161–163why, one step back161162[More info.](execution.md#subprocess)163Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 164–165why, one step back164## Subprocess165Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 166why, one step back166_TypeScript:_ [`Subprocess`](typescript.md)Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 167–169why, one step back167168[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.169Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 170–212why, one step back170### subprocess\[Symbol.asyncIterator\]()171172_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)173174Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.175176[More info.](lines.md#progressive-splitting)177178### subprocess.iterable(readableOptions?)179180`readableOptions`: [`ReadableOptions`](#readableoptions)\181_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)182183Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.184185[More info.](lines.md#progressive-splitting)186187### subprocess.pipe(file, arguments?, options?)188189`file`: `string | URL`\190`arguments`: `string[]`\191`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\192_Returns_: [`Promise<Result>`](#result)193194[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.195196This 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.197198[More info.](pipe.md#array-syntax)199200### subprocess.pipe\`command\`201### subprocess.pipe(options)\`command\`202203`command`: `string`\204`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\205_Returns_: [`Promise<Result>`](#result)206207Like [`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).208209[More info.](pipe.md#template-string-syntax)210211### subprocess.pipe(secondSubprocess, pipeOptions?)212Rename some types (#1009)ehmickybefore adoption2ef9186
line 213why, one step back213`secondSubprocess`: [`ResultPromise`](#return-value)\Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 214–216why, one step back214`pipeOptions`: [`PipeOptions`](#pipeoptions)\215_Returns_: [`Promise<Result>`](#result)216Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 217why, one step back217Like [`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 218–222why, one step back218219[More info.](pipe.md#advanced-syntax)220221#### pipeOptions222Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 223why, one step back223_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 224–226why, one step back224225#### pipeOptions.from226Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 227–228why, one step back227_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\228_Default:_ `"stdout"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 229–237why, one step back229230Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.231232`"all"` pipes both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.233234[More info.](pipe.md#source-file-descriptor)235236#### pipeOptions.to237Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 238–239why, one step back238_Type:_ `"stdin" | "fd3" | "fd4" | ...`\239_Default:_ `"stdin"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 240–246why, one step back240241Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.242243[More info.](pipe.md#destination-file-descriptor)244245#### pipeOptions.unpipeSignal246Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 247why, one step back247_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 248–259why, one step back248249Unpipe the subprocess when the signal aborts.250251[More info.](pipe.md#unpipe)252253### subprocess.kill(signal, error?)254### subprocess.kill(error?)255256`signal`: `string | number`\257`error`: `Error`\258_Returns_: `boolean`259Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 260why, one step back260Sends 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 261–269why, one step back261262This returns `false` when the signal could not be sent, for example when the subprocess has already exited.263264When 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).265266[More info.](termination.md)267268### subprocess.pid269Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 270why, one step back270_Type:_ `number | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 271–277why, one step back271272Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).273274This is `undefined` if the subprocess failed to spawn.275276[More info.](termination.md#inter-process-termination)277Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 278why, one step back278### subprocess.sendMessage(message, sendMessageOptions)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 279why, one step back279Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 280why, one step back280`message`: [`Message`](ipc.md#message-type)\Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 281why, one step back281`sendMessageOptions`: [`SendMessageOptions`](#sendmessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 282why, one step back282_Returns_: `Promise<void>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 283why, one step back283Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 284why, one step back284Send a `message` to the subprocess.Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 285why, one step back285Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 286why, one step back286This 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 287–289why, one step back287288[More info.](ipc.md#exchanging-messages)289Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 290why, one step back290### subprocess.getOneMessage(getOneMessageOptions?)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 291why, one step back291Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 292why, one step back292`getOneMessageOptions`: [`GetOneMessageOptions`](#getonemessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 293why, one step back293_Returns_: [`Promise<Message>`](ipc.md#message-type)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 294why, one step back294Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 295why, one step back295Receive a single `message` from the subprocess.Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 296why, one step back296Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 297why, one step back297This 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 298–300why, one step back298299[More info.](ipc.md#exchanging-messages)300Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 301–310why, one step back301### subprocess.getEachMessage()302303_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)304305Iterate over each `message` from the subprocess.306307This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.308309[More info.](ipc.md#listening-to-messages)310Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 311–312why, one step back311### subprocess.stdin312Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 313why, one step back313_Type:_ [`Writable | null`](https://nodejs.org/api/stream.html#class-streamwritable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 314–322why, one step back314315The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.316317This 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).318319[More info.](streams.md#manual-streaming)320321### subprocess.stdout322Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 323why, one step back323_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 324–332why, one step back324325The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.326327This 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`.328329[More info.](streams.md#manual-streaming)330331### subprocess.stderr332Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 333why, one step back333_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 334–342why, one step back334335The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.336337This 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`.338339[More info.](streams.md#manual-streaming)340341### subprocess.all342Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 343why, one step back343_Type:_ [`Readable | undefined`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 344–354why, one step back344345Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).346347This requires the [`all`](#optionsall) option to be `true`.348349This 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`.350351More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).352353### subprocess.stdio354Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 355why, one step back355_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 356–373why, one step back356357The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.358359Each 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`.360361[More info.](streams.md#manual-streaming)362363### subprocess.readable(readableOptions?)364365`readableOptions`: [`ReadableOptions`](#readableoptions)\366_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream367368Converts the subprocess to a readable stream.369370[More info.](streams.md#converting-a-subprocess-to-a-stream)371372#### readableOptions373Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 374why, one step back374_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 375–377why, one step back375376#### readableOptions.from377Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 378–379why, one step back378_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\379_Default:_ `"stdout"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 380–388why, one step back380381Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.382383`"all"` reads both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.384385[More info.](streams.md#different-file-descriptor)386387#### readableOptions.binary388Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 389–390why, one step back389_Type:_ `boolean`\390_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 391–401why, one step back391392If `false`, iterates over lines. Each line is a string.393394If `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)).395396This is always `true` when the [`encoding`](#optionsencoding) option is binary.397398More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).399400#### readableOptions.preserveNewlines401Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 402–403why, one step back402_Type:_ `boolean`\403_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 404–419why, one step back404405If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.406407[More info.](lines.md#iterable)408409### subprocess.writable(writableOptions?)410411`writableOptions`: [`WritableOptions`](#writableoptions)\412_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream413414Converts the subprocess to a writable stream.415416[More info.](streams.md#converting-a-subprocess-to-a-stream)417418#### writableOptions419Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 420why, one step back420_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 421–423why, one step back421422#### writableOptions.to423Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 424–425why, one step back424_Type:_ `"stdin" | "fd3" | "fd4" | ...`\425_Default:_ `"stdin"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 426–441why, one step back426427Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.428429[More info.](streams.md#different-file-descriptor)430431### subprocess.duplex(duplexOptions?)432433`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\434_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream435436Converts the subprocess to a duplex stream.437438[More info.](streams.md#converting-a-subprocess-to-a-stream)439440## Result441Improve documentation of signal handling (#1105)ehmickybefore adoption01a4b42
line 442why, one step back442_TypeScript:_ [`Result`](typescript.md) or [`SyncResult`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 443why, one step back443_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 444why, one step back444Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 445why, one step back445[Result](execution.md#result) of a subprocess successful execution.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 446–450why, one step back446447When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.448449### result.stdout450Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 451why, one step back451_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 452–462why, one step back452453The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).454455This 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`.456457This 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).458459[More info.](output.md#stdout-and-stderr)460461### result.stderr462Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 463why, one step back463_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 464–474why, one step back464465The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).466467This 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`.468469This 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).470471[More info.](output.md#stdout-and-stderr)472473### result.all474Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 475why, one step back475_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 476–488why, one step back476477The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.478479This requires the [`all`](#optionsall) option to be `true`.480481This 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`.482483This 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).484485[More info.](output.md#interleaved-output)486487### result.stdio488Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 489why, one step back489_Type:_ `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 490–498why, one step back490491The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).492493Items 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`.494495Items are arrays when their corresponding `stdio` option is a [transform in object mode](transform.md#object-mode).496497[More info.](output.md#additional-file-descriptors)498Rename `result.ipc` to `result.ipcOutput` (#1075)ehmickybefore adoptionae9b360
line 499why, one step back499### result.ipcOutputAdd `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
line 500why, one step back500Fix type of `result.ipc` (#1071)ehmickybefore adoption69152ec
line 501why, one step back501_Type_: [`Message[]`](ipc.md#message-type)Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
line 502why, one step back502Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 503why, one step back503All the messages [sent by the subprocess](#sendmessagemessage-sendmessageoptions) to the current process.Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
lines 504–508why, one step back504505This is empty unless the [`ipc`](#optionsipc) option is `true`. Also, this is empty if the [`buffer`](#optionsbuffer) option is `false`.506507[More info.](ipc.md#retrieve-all-messages)508Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 509–510why, one step back509### result.pipedFrom510Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 511why, one step back511_Type:_ [`Array<Result | ExecaError>`](#result)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 512–520why, one step back512513[Results](#result) of the other subprocesses that were piped into this subprocess.514515This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.516517[More info.](pipe.md#result)518519### result.command520Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 521why, one step back521_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 522–528why, one step back522523The file and [arguments](input.md#command-arguments) that were run.524525[More info.](debugging.md#command)526527### result.escapedCommand528Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 529why, one step back529_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 530–536why, one step back530531Same as [`command`](#resultcommand) but escaped.532533[More info.](debugging.md#command)534535### result.cwd536Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 537why, one step back537_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 538–544why, one step back538539The [current directory](#optionscwd) in which the command was run.540541[More info.](environment.md#current-directory)542543### result.durationMs544Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 545why, one step back545_Type:_ `number`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 546–552why, one step back546547Duration of the subprocess, in milliseconds.548549[More info.](debugging.md#duration)550551### result.failed552Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 553why, one step back553_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 554–556why, one step back554555Whether the subprocess failed to run.556Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 557–558why, one step back557When this is `true`, the result is an [`ExecaError`](#execaerror) instance with additional error-related properties.558Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 559–560why, one step back559[More info.](errors.md#subprocess-failure)560Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 561–562why, one step back561## ExecaError562## ExecaSyncErrorMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 563why, one step back563Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 564why, one step back564_Type:_ `Error`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 565–575why, one step back565566Result of a subprocess [failed execution](errors.md#subprocess-failure).567568This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.569570This has the same shape as [successful results](#result), with the following additional properties.571572[More info.](errors.md)573574### error.message575Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 576why, one step back576_Type:_ `string`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 577–583why, one step back577578Error message when the subprocess [failed](errors.md#subprocess-failure) to run.579580[More info.](errors.md#error-message)581582### error.shortMessage583Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 584why, one step back584_Type:_ `string`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 585–591why, one step back585586This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).587588[More info.](errors.md#error-message)589590### error.originalMessage591Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 592why, one step back592_Type:_ `string | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 593–599why, one step back593594Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.595596[More info.](errors.md#error-message)597598### error.cause599Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 600why, one step back600_Type:_ `unknown | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 601–609why, one step back601602Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).603604This is usually an `Error` instance.605606[More info.](termination.md#error-message-and-stack-trace)607608### error.code609Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 610why, one step back610_Type:_ `string | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 611–615why, one step back611612Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.613614### error.timedOut615Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 616why, one step back616_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 617–621why, one step back617618Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.619620[More info.](termination.md#timeout)621Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 622why, one step back622### error.isCanceledMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 623why, one step back623Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 624why, one step back624_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 625–629why, one step back625626Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.627628[More info.](termination.md#canceling)629Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 630why, one step back630### error.isMaxBufferMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 631why, one step back631Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 632why, one step back632_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 633–637why, one step back633634Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.635636[More info.](output.md#big-output)637Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 638why, one step back638### error.isTerminatedMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 639why, one step back639Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 640why, one step back640_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 641–647why, one step back641642Whether the subprocess was terminated by a [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) sent by either:643- The current process.644- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).645646[More info.](termination.md#signal-name-and-description)647Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 648why, one step back648### error.exitCodeMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 649why, one step back649Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 650why, one step back650_Type:_ `number | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 651–653why, one step back651652The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.653Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 654why, one step back654This 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 655–657why, one step back655656[More info.](errors.md#exit-code)657Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 658why, one step back658### error.signalMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 659why, one step back659Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 660why, one step back660_Type:_ `string | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 661–669why, one step back661662The name of the [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) that terminated the subprocess, sent by either:663- The current process.664- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).665666If a signal terminated the subprocess, this property is defined and included in the [error message](#errormessage). Otherwise it is `undefined`.667668[More info.](termination.md#signal-name-and-description)669Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 670why, one step back670### error.signalDescriptionMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 671why, one step back671Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 672why, one step back672_Type:_ `string | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 673–681why, one step back673674A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.675676If 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.677678[More info.](termination.md#signal-name-and-description)679680## Options681Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 682why, one step back682_TypeScript:_ [`Options`](typescript.md) or [`SyncOptions`](typescript.md\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 683why, one step back683_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 684–690why, one step back684685This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).686687The 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).688689### options.preferLocal690Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 691–692why, one step back691_Type:_ `boolean`\692_Default:_ `true` with [`$`](#file-arguments-options), `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 693–699why, one step back693694Prefer locally installed binaries when looking for a binary to execute.695696[More info.](environment.md#local-binaries)697698### options.localDir699Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 700–701why, one step back700_Type:_ `string | URL`\701_Default:_ [`cwd`](#optionscwd) optionMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 702–708why, one step back702703Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.704705[More info.](environment.md#local-binaries)706707### options.node708Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 709–710why, one step back709_Type:_ `boolean`\710_Default:_ `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 711–713why, one step back711712If `true`, runs with Node.js. The first argument must be a Node.js file.713Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5
lines 714–715why, one step back714The 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.715Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 716–719why, one step back716[More info.](node.md)717718### options.nodeOptions719Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 720why, one step back720_Type:_ `string[]`\Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5
line 721why, one step back721_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 722–730why, one step back722723List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).724725Requires the [`node`](#optionsnode) option to be `true`.726727[More info.](node.md#nodejs-cli-flags)728729### options.nodePath730Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 731–732why, one step back731_Type:_ `string | URL`\732_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 733–741why, one step back733734Path to the Node.js executable.735736Requires the [`node`](#optionsnode) option to be `true`.737738[More info.](node.md#nodejs-version)739740### options.shell741Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 742–743why, one step back742_Type:_ `boolean | string | URL`\743_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 744–754why, one step back744745If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).746747Uses [`/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.748749We [recommend against](shell.md#avoiding-shells) using this option.750751[More info.](shell.md)752753### options.cwd754Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 755–756why, one step back755_Type:_ `string | URL`\756_Default:_ `process.cwd()`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 757–765why, one step back757758Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.759760This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.761762[More info.](environment.md#current-directory)763764### options.env765Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 766–767why, one step back766_Type:_ `object`\767_Default:_ [`process.env`](https://nodejs.org/api/process.html#processenv)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 768–776why, one step back768769[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).770771Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).772773[More info.](input.md#environment-variables)774775### options.extendEnv776Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 777–778why, one step back777_Type:_ `boolean`\778_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 779–786why, one step back779780If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).781If `false`, only the `env` option is used, not `process.env`.782783[More info.](input.md#environment-variables)784785### options.input786Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 787why, one step back787_Type:_ `string | Uint8Array | stream.Readable`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 788–796why, one step back788789Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).790791See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.792793[More info.](input.md#string-input)794795### options.inputFile796Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 797why, one step back797_Type:_ `string | URL`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 798–806why, one step back798799Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).800801See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.802803[More info.](input.md#file-input)804805### options.stdin806Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 807why, one step back807_TypeScript:_ [`StdinOption`](typescript.md) or [`StdinSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 808–809why, one step back808_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)\809_Default:_ `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 810–818why, one step back810811How 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).812813This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.814815More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).816817### options.stdout818Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 819why, one step back819_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 820–821why, one step back820_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)\821_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 822–830why, one step back822823How 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).824825This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.826827More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).828829### options.stderr830Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 831why, one step back831_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 832–833why, one step back832_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)\833_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 834–842why, one step back834835How 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).836837This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.838839More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).840841### options.stdio842Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 843why, one step back843_TypeScript:_ [`Options['stdio']`](typescript.md) or [`SyncOptions['stdio']`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 844–845why, one step back844_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)\845_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 846–856why, one step back846847Like 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'}`.848849A single string can be used [as a shortcut](output.md#shortcut).850851The array can have more than 3 items, to create [additional file descriptors](output.md#additional-file-descriptors) beyond [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr).852853More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).854855### options.all856Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 857–858why, one step back857_Type:_ `boolean`\858_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 859–865why, one step back859860Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.861862[More info.](output.md#interleaved-output)863864### options.encoding865Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 866–867why, one step back866_Type:_ `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\867_Default:_ `'utf8'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 868–880why, one step back868869If 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).870871If it outputs binary data instead, this should be either:872- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).873- [`'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.874875The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).876877[More info.](binary.md)878879### options.lines880Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 881–882why, one step back881_Type:_ `boolean`\882_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 883–893why, one step back883884Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.885886This cannot be used if the [`encoding`](#optionsencoding) option is [binary](binary.md#binary-output).887888By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).889890[More info.](lines.md#simple-splitting)891892### options.stripFinalNewline893Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 894–895why, one step back894_Type:_ `boolean`\895_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 896–906why, one step back896897Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.898899If the [`lines`](#optionslines) option is true, this applies to each output line instead.900901By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).902903[More info.](lines.md#newlines)904905### options.maxBuffer906Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 907–908why, one step back907_Type:_ `number`\908_Default:_ `100_000_000`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 909–917why, one step back909910Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).911912By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).913914[More info.](output.md#big-output)915916### options.buffer917Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 918–919why, one step back918_Type:_ `boolean`\919_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 920–928why, one step back920921When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.922923By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).924925[More info.](output.md#low-memory)926927### options.ipc928Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 929why, one step back929_Type:_ `boolean`\Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
line 930why, one step back930_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 931why, one step back931Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 932why, one step back932Enables exchanging messages with the subprocess using [`subprocess.sendMessage(message)`](#subprocesssendmessagemessage-sendmessageoptions), [`subprocess.getOneMessage()`](#subprocessgetonemessagegetonemessageoptions) and [`subprocess.getEachMessage()`](#subprocessgeteachmessage).Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 933why, one step back933Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 934–935why, one step back934The subprocess must be a Node.js file.935Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 936–939why, one step back936[More info.](ipc.md)937938### options.serialization939Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 940–941why, one step back940_Type:_ `'json' | 'advanced'`\941_Default:_ `'advanced'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 942–945why, one step back942943Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option.944945[More info.](ipc.md#message-type)Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 946–955why, one step back946947### options.ipcInput948949_Type_: [`Message`](ipc.md#message-type)950951Sends an IPC message when the subprocess starts.952953The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.954955More 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 956–958why, one step back956957### options.verbose958Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 959–960why, one step back959_Type:_ `'none' | 'short' | 'full'`\960_Default:_ `'none'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 961–963why, one step back961962If `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.963Log IPC messages with `verbose: 'full'` (#1063)ehmickybefore adoption839c2fe
line 964why, one step back964If `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 965–971why, one step back965966By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).967968[More info.](debugging.md#verbose-mode)969970### options.reject971Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 972–973why, one step back972_Type:_ `boolean`\973_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 974why, one step back974Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 975why, one step back975Setting 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 976–980why, one step back976977[More info.](errors.md#preventing-exceptions)978979### options.timeout980Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 981–982why, one step back981_Type:_ `number`\982_Default:_ `0`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 983–985why, one step back983984If `timeout` is greater than `0`, the subprocess will be [terminated](#optionskillsignal) if it runs for longer than that amount of milliseconds.985Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 986why, one step back986On timeout, [`result.timedOut`](#errortimedout) becomes `true`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 987–991why, one step back987988[More info.](termination.md#timeout)989990### options.cancelSignal991Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 992why, one step back992_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 993–995why, one step back993994You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).995Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 996why, one step back996When `AbortController.abort()` is called, [`result.isCanceled`](#erroriscanceled) becomes `true`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 997–1001why, one step back997998[More info.](termination.md#canceling)9991000### options.forceKillAfterDelay1001Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1002–1003why, one step back1002_Type:_ `number | false`\1003_Default:_ `5000`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1004–1010why, one step back10041005If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).10061007[More info.](termination.md#forceful-termination)10081009### options.killSignal1010Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1011–1012why, one step back1011_Type:_ `string | number`\1012_Default:_ `'SIGTERM'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1013–1021why, one step back10131014Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10151016This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10171018[More info.](termination.md#default-signal)10191020### options.detached1021Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1022–1023why, one step back1022_Type:_ `boolean`\1023_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1024–1030why, one step back10241025Run the subprocess independently from the current process.10261027[More info.](environment.md#background-subprocess)10281029### options.cleanup1030Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1031–1032why, one step back1031_Type:_ `boolean`\1032_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1033–1039why, one step back10331034Kill the subprocess when the current process exits.10351036[More info.](termination.md#current-process-exit)10371038### options.uid1039Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1040–1041why, one step back1040_Type:_ `number`\1041_Default:_ current user identifierMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1042–1048why, one step back10421043Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10441045[More info.](windows.md#uid-and-gid)10461047### options.gid1048Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1049–1050why, one step back1049_Type:_ `number`\1050_Default:_ current group identifierMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1051–1057why, one step back10511052Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.10531054[More info.](windows.md#uid-and-gid)10551056### options.argv01057Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1058–1059why, one step back1058_Type:_ `string`\1059_Default:_ file being executedMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1060–1064why, one step back10601061Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10621063### options.windowsHide1064Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1065–1066why, one step back1065_Type:_ `boolean`\1066_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1067–1073why, one step back10671068On Windows, do not create a new console window.10691070[More info.](windows.md#console-window)10711072### options.windowsVerbatimArguments1073Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1074–1075why, one step back1074_Type:_ `boolean`\1075_Default:_ `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1076–1090why, one step back10761077If `false`, escapes the command arguments on Windows.10781079[More info.](windows.md#cmdexe-escaping)10801081## Transform options10821083A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.10841085A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.10861087[More info.](transform.md)10881089### transformOptions.transform1090Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1091why, one step back1091_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1092–1098why, one step back10921093Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.10941095More info [here](transform.md#summary) and [there](transform.md#sharing-state).10961097### transformOptions.final1098Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1099why, one step back1099_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1100–1106why, one step back11001101Create additional lines after the last one.11021103[More info.](transform.md#finalizing)11041105### transformOptions.binary1106Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1107–1108why, one step back1107_Type:_ `boolean`\1108_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1109–1115why, one step back11091110If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.11111112[More info.](binary.md#transforms)11131114### transformOptions.preserveNewlines1115Fix 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`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11201121[More info.](lines.md#transforms)11221123### transformOptions.objectMode1124Fix 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–1135why, one step back11271128If `true`, allow [`transformOptions.transform`](#transformoptionstransform) and [`transformOptions.final`](#transformoptionsfinal) to return any type, not just `string` or `Uint8Array`.11291130[More info.](transform.md#object-mode)11311132<hr>11331134[**Previous**: 🔍 Differences with Bash and zx](bash.md)\1135[**Top**: Table of contents](../readme.md#documentation)