stringDecoder.end([buffer])
buffer<Buffer> | <TypedArray> | <DataView> 一个Buffer、TypedArray或DataView,包含要解码的字节。- 返回:<string>
返回存储在内部缓冲区中的任何剩余输入作为字符串。表示不完整 UTF-8 和 UTF-16 字符的字节将被替换为适合该字符编码的替代字符。
【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.】
如果提供了 buffer 参数,在返回剩余输入之前会对 stringDecoder.write() 进行最后一次调用。调用 end() 之后,stringDecoder 对象可以用于新的输入。
【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.】