mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-07 08:33:50 +08:00
A typed read() checked the stream's representation before reading, but the read itself can change it: a lazy Readable.from pull over a dynamic array makes the stream hold strings with its first string, and _read can call setEncoding(). The string then came back typed as a Buffer. Reads now answer each chunk's kind as it was taken from the buffer: typed read() and the typed iterator throw the encoding fence for a string, the dynamic read boxes by that kind, and entries released after a 'data' emit are released by it.