Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: edit maxBuffer/Unicode paragraph for clarity #11228

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1157,16 +1157,11 @@ to the same value.

## `maxBuffer` and Unicode

It is important to keep in mind that the `maxBuffer` option specifies the
largest number of *octets* allowed on `stdout` or `stderr`. If this value is
exceeded, then the child process is terminated. This particularly impacts
output that includes multibyte character encodings such as UTF-8 or UTF-16.
For instance, the following will output 13 UTF-8 encoded octets to `stdout`
although there are only 4 characters:

```js
console.log('中文测试');
```
The `maxBuffer` option specifies the largest number of bytes allowed on `stdout`
or `stderr`. If this value is exceeded, then the child process is terminated.
This impacts output that includes multibyte character encodings such as UTF-8 or
UTF-16. For instance, `console.log('中文测试')` will send 13 UTF-8 encoded bytes
to `stdout` although there are only 4 characters.

[`'error'`]: #child_process_event_error
[`'exit'`]: #child_process_event_exit
Expand Down