StringDecoder
A Node.js class that turns a series of Buffer chunks into text without breaking characters that are split across chunk boundaries.
In more detail
It holds back the incomplete bytes at the end of a chunk until the rest arrive. Streams use it when you call setEncoding().
Related terms
- multi-byte character — A character that takes more than one byte in its encoding, such as é (two bytes in UTF-8) or most emoji (four bytes).
- UTF-8 — The most widely used character encoding, which can represent every Unicode character and matches ASCII for plain English letters.
- chunk — One piece of a larger piece of data delivered by a stream.
Taught in
- Buffer Encodings: UTF-8, Hex, Base64 & Slicing — Node.js Internals & Backend Services