maxBuffer 和 Unicode

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