Skip to content
Myr

api.md

This file

Path

docs/api.md

1,106 lines · 43.8 KiB · Markdown

Last changed by

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

History of this file

Take it

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

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

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

line 48why, one step back
48

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

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

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

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

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

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

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

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

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

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

line 90why, one step back
90

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

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

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 95–125why, one step back
95### sendMessage(message)
9697`message`: [`Message`](ipc.md#message-type)\98_Returns_: `Promise<void>`99100Send a `message` to the parent process.101102This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.103104[More info.](ipc.md#exchanging-messages)105106### getOneMessage()107108_Returns_: [`Promise<Message>`](ipc.md#message-type)109110Receive a single `message` from the parent process.111112This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.113114[More info.](ipc.md#exchanging-messages)115116### getEachMessage()117118_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)119120Iterate over each `message` from the parent process.121122This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.123124[More info.](ipc.md#listening-to-messages)125

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

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

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

line 127why, one step back
127

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

line 130why, one step back
130

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

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

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

lines 132–133why, one step back
132- the [subprocess](#subprocess).
133- 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 134–136why, one step back
134
135[More info.](execution.md#subprocess)136

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

lines 137–138why, one step back
137## Subprocess
138

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 143–185why, one step back
143### subprocess\[Symbol.asyncIterator\]()
144145_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)146147Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.148149[More info.](lines.md#progressive-splitting)150151### subprocess.iterable(readableOptions?)152153`readableOptions`: [`ReadableOptions`](#readableoptions)\154_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)155156Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.157158[More info.](lines.md#progressive-splitting)159160### subprocess.pipe(file, arguments?, options?)161162`file`: `string | URL`\163`arguments`: `string[]`\164`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\165_Returns_: [`Promise<Result>`](#result)166167[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.168169This 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.170171[More info.](pipe.md#array-syntax)172173### subprocess.pipe\`command\`174### subprocess.pipe(options)\`command\`175176`command`: `string`\177`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\178_Returns_: [`Promise<Result>`](#result)179180Like [`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).181182[More info.](pipe.md#template-string-syntax)183184### subprocess.pipe(secondSubprocess, pipeOptions?)185

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

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

line 190why, one step back
190Like [`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 191–195why, one step back
191
192[More info.](pipe.md#advanced-syntax)193194#### pipeOptions195

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

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

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

lines 197–199why, one step back
197
198#### pipeOptions.from199

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

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

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

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

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

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

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

lines 213–219why, one step back
213
214Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.215216[More info.](pipe.md#destination-file-descriptor)217218#### pipeOptions.unpipeSignal219

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

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

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

lines 221–232why, one step back
221
222Unpipe the subprocess when the signal aborts.223224[More info.](pipe.md#unpipe)225226### subprocess.kill(signal, error?)227### subprocess.kill(error?)228229`signal`: `string | number`\230`error`: `Error`\231_Returns_: `boolean`232

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

line 233why, one step back
233Sends 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 234–242why, one step back
234
235This returns `false` when the signal could not be sent, for example when the subprocess has already exited.236237When 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).238239[More info.](termination.md)240241### subprocess.pid242

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

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

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 252why, one step back
252

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 255why, one step back
255

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 257why, one step back
257

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 258why, one step back
258This 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 259–261why, one step back
259
260[More info.](ipc.md#exchanging-messages)261

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 262why, one step back
262### subprocess.getOneMessage()

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

line 263why, one step back
263

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 265why, one step back
265

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 267why, one step back
267

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 268why, one step back
268This 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 269–271why, one step back
269
270[More info.](ipc.md#exchanging-messages)271

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 282–283why, one step back
282### subprocess.stdin
283

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

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

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

lines 285–293why, one step back
285
286The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.287288This 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).289290[More info.](streams.md#manual-streaming)291292### subprocess.stdout293

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

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

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

lines 295–303why, one step back
295
296The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.297298This 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`.299300[More info.](streams.md#manual-streaming)301302### subprocess.stderr303

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

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

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

lines 305–313why, one step back
305
306The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.307308This 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`.309310[More info.](streams.md#manual-streaming)311312### subprocess.all313

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

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

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

lines 315–325why, one step back
315
316Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).317318This requires the [`all`](#optionsall) option to be `true`.319320This 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`.321322More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).323324### subprocess.stdio325

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

line 326why, one step back
326_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 327–344why, one step back
327
328The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.329330Each 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`.331332[More info.](streams.md#manual-streaming)333334### subprocess.readable(readableOptions?)335336`readableOptions`: [`ReadableOptions`](#readableoptions)\337_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream338339Converts the subprocess to a readable stream.340341[More info.](streams.md#converting-a-subprocess-to-a-stream)342343#### readableOptions344

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

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

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

lines 346–348why, one step back
346
347#### readableOptions.from348

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

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

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

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

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

lines 360–361why, one step back
360_Type:_ `boolean`\
361_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 362–372why, one step back
362
363If `false`, iterates over lines. Each line is a string.364365If `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)).366367This is always `true` when the [`encoding`](#optionsencoding) option is binary.368369More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).370371#### readableOptions.preserveNewlines372

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

lines 373–374why, one step back
373_Type:_ `boolean`\
374_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 375–390why, one step back
375
376If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.377378[More info.](lines.md#iterable)379380### subprocess.writable(writableOptions?)381382`writableOptions`: [`WritableOptions`](#writableoptions)\383_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream384385Converts the subprocess to a writable stream.386387[More info.](streams.md#converting-a-subprocess-to-a-stream)388389#### writableOptions390

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

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

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

lines 392–394why, one step back
392
393#### writableOptions.to394

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

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

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

lines 397–412why, one step back
397
398Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.399400[More info.](streams.md#different-file-descriptor)401402### subprocess.duplex(duplexOptions?)403404`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\405_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream406407Converts the subprocess to a duplex stream.408409[More info.](streams.md#converting-a-subprocess-to-a-stream)410411## Result412

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

line 415why, one step back
415

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

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

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

lines 417–421why, one step back
417
418When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.419420### result.stdout421

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

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

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

lines 423–433why, one step back
423
424The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).425426This 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`.427428This 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).429430[More info.](output.md#stdout-and-stderr)431432### result.stderr433

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

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

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

lines 435–445why, one step back
435
436The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).437438This 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`.439440This 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).441442[More info.](output.md#stdout-and-stderr)443444### result.all445

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

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

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

lines 447–459why, one step back
447
448The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.449450This requires the [`all`](#optionsall) option to be `true`.451452This 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`.453454This 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).455456[More info.](output.md#interleaved-output)457458### result.stdio459

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

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

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

lines 461–469why, one step back
461
462The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).463464Items 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`.465466Items are arrays when their corresponding `stdio` option is a [transform in object mode](transform.md#object-mode).467468[More info.](output.md#additional-file-descriptors)469

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

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

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

line 471why, one step back
471

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

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

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

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

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

lines 480–481why, one step back
480### result.pipedFrom
481

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

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

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

lines 483–491why, one step back
483
484[Results](#result) of the other subprocesses that were piped into this subprocess.485486This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.487488[More info.](pipe.md#result)489490### result.command491

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

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

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

lines 493–499why, one step back
493
494The file and [arguments](input.md#command-arguments) that were run.495496[More info.](debugging.md#command)497498### result.escapedCommand499

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

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

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

lines 501–507why, one step back
501
502Same as [`command`](#resultcommand) but escaped.503504[More info.](debugging.md#command)505506### result.cwd507

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

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

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

lines 509–515why, one step back
509
510The [current directory](#optionscwd) in which the command was run.511512[More info.](environment.md#current-directory)513514### result.durationMs515

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

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

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

lines 517–523why, one step back
517
518Duration of the subprocess, in milliseconds.519520[More info.](debugging.md#duration)521522### result.failed523

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

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

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

lines 525–527why, one step back
525
526Whether the subprocess failed to run.527

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

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

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

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

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

lines 532–533why, one step back
532## ExecaError
533## ExecaSyncError

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

line 534why, one step back
534

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

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

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

lines 536–546why, one step back
536
537Result of a subprocess [failed execution](errors.md#subprocess-failure).538539This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.540541This has the same shape as [successful results](#result), with the following additional properties.542543[More info.](errors.md)544545### error.message546

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

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

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

lines 548–554why, one step back
548
549Error message when the subprocess [failed](errors.md#subprocess-failure) to run.550551[More info.](errors.md#error-message)552553### error.shortMessage554

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

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

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

lines 556–562why, one step back
556
557This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).558559[More info.](errors.md#error-message)560561### error.originalMessage562

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

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

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

lines 564–570why, one step back
564
565Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.566567[More info.](errors.md#error-message)568569### error.cause570

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

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

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

lines 572–580why, one step back
572
573Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).574575This is usually an `Error` instance.576577[More info.](termination.md#error-message-and-stack-trace)578579### error.code580

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

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

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

lines 582–586why, one step back
582
583Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.584585### error.timedOut586

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

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

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

lines 588–592why, one step back
588
589Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.590591[More info.](termination.md#timeout)592

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

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

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

line 594why, one step back
594

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

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

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

lines 596–600why, one step back
596
597Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.598599[More info.](termination.md#canceling)600

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

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

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

line 602why, one step back
602

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

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

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

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

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

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

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

line 610why, one step back
610

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

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

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

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

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

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

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

line 620why, one step back
620

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

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

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

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

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

line 625why, one step back
625This 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 626–628why, one step back
626
627[More info.](errors.md#exit-code)628

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

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

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

line 630why, one step back
630

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

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

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

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

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

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

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

line 642why, one step back
642

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

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

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

lines 644–652why, one step back
644
645A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.646647If 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.648649[More info.](termination.md#signal-name-and-description)650651## Options652

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 655–661why, one step back
655
656This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).657658The 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).659660### options.preferLocal661

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

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

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

lines 664–670why, one step back
664
665Prefer locally installed binaries when looking for a binary to execute.666667[More info.](environment.md#local-binaries)668669### options.localDir670

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

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

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

lines 673–679why, one step back
673
674Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.675676[More info.](environment.md#local-binaries)677678### options.node679

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

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

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

lines 682–684why, one step back
682
683If `true`, runs with Node.js. The first argument must be a Node.js file.684

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

lines 685–686why, one step back
685The 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.
686

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

lines 687–690why, one step back
687[More info.](node.md)
688689### options.nodeOptions690

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

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

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

line 692why, one step back
692_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 693–701why, one step back
693
694List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).695696Requires the [`node`](#optionsnode) option to be `true`.697698[More info.](node.md#nodejs-cli-flags)699700### options.nodePath701

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

lines 702–703why, one step back
702_Type:_ `string | URL`\
703_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 704–712why, one step back
704
705Path to the Node.js executable.706707Requires the [`node`](#optionsnode) option to be `true`.708709[More info.](node.md#nodejs-version)710711### options.shell712

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

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

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

lines 715–725why, one step back
715
716If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).717718Uses [`/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.719720We [recommend against](shell.md#avoiding-shells) using this option.721722[More info.](shell.md)723724### options.cwd725

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

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

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

lines 728–736why, one step back
728
729Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.730731This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.732733[More info.](environment.md#current-directory)734735### options.env736

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

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

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

lines 739–747why, one step back
739
740[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).741742Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).743744[More info.](input.md#environment-variables)745746### options.extendEnv747

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

lines 748–749why, one step back
748_Type:_ `boolean`\
749_Default:_ `true`

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

lines 750–757why, one step back
750
751If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).752If `false`, only the `env` option is used, not `process.env`.753754[More info.](input.md#environment-variables)755756### options.input757

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

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

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

lines 759–767why, one step back
759
760Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).761762See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.763764[More info.](input.md#string-input)765766### options.inputFile767

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

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

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

lines 769–777why, one step back
769
770Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).771772See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.773774[More info.](input.md#file-input)775776### options.stdin777

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

lines 779–780why, one step back
779_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)\
780_Default:_ `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwise

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

lines 781–789why, one step back
781
782How 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).783784This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.785786More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).787788### options.stdout789

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

lines 791–792why, one step back
791_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)\
792_Default:_ `pipe`

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

lines 793–801why, one step back
793
794How 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).795796This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.797798More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).799800### options.stderr801

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

lines 803–804why, one step back
803_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)\
804_Default:_ `pipe`

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

lines 805–813why, one step back
805
806How 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).807808This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.809810More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).811812### options.stdio813

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

lines 815–816why, one step back
815_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)\
816_Default:_ `pipe`

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

lines 817–827why, one step back
817
818Like 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'}`.819820A single string can be used [as a shortcut](output.md#shortcut).821822The array can have more than 3 items, to create [additional file descriptors](output.md#additional-file-descriptors) beyond [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr).823824More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).825826### options.all827

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

lines 828–829why, one step back
828_Type:_ `boolean`\
829_Default:_ `false`

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

lines 830–836why, one step back
830
831Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.832833[More info.](output.md#interleaved-output)834835### options.encoding836

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

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

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

lines 839–851why, one step back
839
840If 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).841842If it outputs binary data instead, this should be either:843- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).844- [`'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.845846The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).847848[More info.](binary.md)849850### options.lines851

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

lines 852–853why, one step back
852_Type:_ `boolean`\
853_Default:_ `false`

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

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

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

lines 865–866why, one step back
865_Type:_ `boolean`\
866_Default:_ `true`

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

lines 867–877why, one step back
867
868Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.869870If the [`lines`](#optionslines) option is true, this applies to each output line instead.871872By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).873874[More info.](lines.md#newlines)875876### options.maxBuffer877

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

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

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

lines 880–888why, one step back
880
881Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).882883By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).884885[More info.](output.md#big-output)886887### options.buffer888

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

lines 889–890why, one step back
889_Type:_ `boolean`\
890_Default:_ `true`

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

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

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

line 902why, one step back
902

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 904why, one step back
904

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

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

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

lines 907–910why, one step back
907[More info.](ipc.md)
908909### options.serialization910

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 917–926why, one step back
917
918### options.ipcInput919920_Type_: [`Message`](ipc.md#message-type)921922Sends an IPC message when the subprocess starts.923924The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.925926More 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 927–929why, one step back
927
928### options.verbose929

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

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

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

lines 932–934why, one step back
932
933If `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.934

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

line 935why, one step back
935If `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 936–942why, one step back
936
937By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).938939[More info.](debugging.md#verbose-mode)940941### options.reject942

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

lines 943–944why, one step back
943_Type:_ `boolean`\
944_Default:_ `true`

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

line 945why, one step back
945

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

line 946why, one step back
946Setting 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 947–951why, one step back
947
948[More info.](errors.md#preventing-exceptions)949950### options.timeout951

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

lines 952–953why, one step back
952_Type:_ `number`\
953_Default:_ `0`

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

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

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

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

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

lines 958–962why, one step back
958
959[More info.](termination.md#timeout)960961### options.cancelSignal962

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

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

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

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

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

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

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

lines 968–972why, one step back
968
969[More info.](termination.md#canceling)970971### options.forceKillAfterDelay972

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

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

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

lines 975–981why, one step back
975
976If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).977978[More info.](termination.md#forceful-termination)979980### options.killSignal981

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

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

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

lines 984–992why, one step back
984
985Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.986987This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).988989[More info.](termination.md#default-signal)990991### options.detached992

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

lines 993–994why, one step back
993_Type:_ `boolean`\
994_Default:_ `false`

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

lines 995–1001why, one step back
995
996Run the subprocess independently from the current process.997998[More info.](environment.md#background-subprocess)9991000### options.cleanup1001

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

lines 1002–1003why, one step back
1002_Type:_ `boolean`\
1003_Default:_ `true`

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

lines 1004–1010why, one step back
1004
1005Kill the subprocess when the current process exits.10061007[More info.](termination.md#current-process-exit)10081009### options.uid1010

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

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

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

lines 1013–1019why, one step back
1013
1014Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10151016[More info.](windows.md#uid-and-gid)10171018### options.gid1019

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

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

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

lines 1022–1028why, one step back
1022
1023Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.10241025[More info.](windows.md#uid-and-gid)10261027### options.argv01028

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

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

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

lines 1031–1035why, one step back
1031
1032Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10331034### options.windowsHide1035

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

lines 1036–1037why, one step back
1036_Type:_ `boolean`\
1037_Default:_ `true`

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

lines 1038–1044why, one step back
1038
1039On Windows, do not create a new console window.10401041[More info.](windows.md#console-window)10421043### options.windowsVerbatimArguments1044

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

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

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

lines 1047–1061why, one step back
1047
1048If `false`, escapes the command arguments on Windows.10491050[More info.](windows.md#cmdexe-escaping)10511052## Transform options10531054A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.10551056A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.10571058[More info.](transform.md)10591060### transformOptions.transform1061

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

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

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

lines 1063–1069why, one step back
1063
1064Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.10651066More info [here](transform.md#summary) and [there](transform.md#sharing-state).10671068### transformOptions.final1069

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

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

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

lines 1071–1077why, one step back
1071
1072Create additional lines after the last one.10731074[More info.](transform.md#finalizing)10751076### transformOptions.binary1077

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

lines 1078–1079why, one step back
1078_Type:_ `boolean`\
1079_Default:_ `false`

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

lines 1080–1086why, one step back
1080
1081If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.10821083[More info.](binary.md#transforms)10841085### transformOptions.preserveNewlines1086

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

lines 1087–1088why, one step back
1087_Type:_ `boolean`\
1088_Default:_ `false`

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

lines 1089–1095why, one step back
1089
1090If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.10911092[More info.](lines.md#transforms)10931094### transformOptions.objectMode1095

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

lines 1096–1097why, one step back
1096_Type:_ `boolean`\
1097_Default:_ `false`

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

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