maxBuffer 和 Unicode


maxBuffer 选项指定 stdoutstderr 上允许的最大字节数。 如果超过此值,则终止子进程。 这会影响包含多字节字符编码(例如 UTF-8 或 UTF-16)的输出。 例如,console.log('中文测试') 将向 stdout 发送 13 个 UTF-8 编码字节,尽管只有 4 个字符。

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.