stringDecoder.end([buffer])


以字符串形式返回存储在内部缓冲区中的任何剩余的输入。 表示不完整的 UTF-8 和 UTF-16 字符的字节将被替换为适合字符编码的替换字符。

如果提供了 buffer 参数,则在返回剩余的输入之前执行对 stringDecoder.write() 的最后一次调用。 调用 end() 之后,stringDecoder 对象可以重新用于新的输入。

Returns any remaining input stored in the internal buffer as a string. Bytes representing incomplete UTF-8 and UTF-16 characters will be replaced with substitution characters appropriate for the character encoding.

If the buffer argument is provided, one final call to stringDecoder.write() is performed before returning the remaining input. After end() is called, the stringDecoder object can be reused for new input.