The string_decoder module provides an API for decoding Buffer objects into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters.

See also:

Constructor

Methods

end():String

end(buffer:Buffer):String

end(buffer:ArrayBufferView):String

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.

See also:

write(buffer:Buffer):String

write(buffer:ArrayBufferView):String

Returns a decoded string, ensuring that any incomplete multibyte characters at the end of the Buffer, or TypedArray, or DataViewor are omitted from the returned string and stored in an internal buffer for the next call to stringDecoder.write() or stringDecoder.end().

See also: