readline did the line splitting for you. Time to write it: a
[`Transform`](https://nodejs.org/api/stream.html#class-streamtransform) stream receives byte
chunks on one side and pushes lines on the other. tinyserve will use it to process request
bodies and logs as they arrive.
Complete class LineSplitter extends Transform. Its readable side is in object mode: eachthis.push(line) emits one string.
\n; a \r just before it (or at the very end) is removed.''. The text after the last \n, if any, is emitted when the input ends — in _flush(callback).
\r and \n, or inside amulti-byte UTF-8 character.
The driver cuts the UTF-8 bytes of each test's text at the given byte offsets and pipes the
pieces through your splitter.
é is two bytes (c3 a9). If one chunk ends with c3, chunk.toString() produces �
— the character is lost. A
[`StringDecoder`](https://nodejs.org/api/string_decoder.html) keeps incomplete characters
until the next write(), and end() returns what is left.
// text 'café\nthé\n' cut at byte 4 → chunks 'caf\xc3' and '\xa9\nthé\n'
// → ['café', 'thé']Sample tests