This module makes it easy to send and receive bytes over streams.
import { byteStream } from 'it-byte-stream'const stream = byteStream(duplex)// read the next chunkconst bytes = await stream.read()// read the next five bytesconst fiveBytes = await stream.read(5)// write bytes into the streamawait stream.write(Uint8Array.from([0, 1, 2, 3, 4])) Copy
import { byteStream } from 'it-byte-stream'const stream = byteStream(duplex)// read the next chunkconst bytes = await stream.read()// read the next five bytesconst fiveBytes = await stream.read(5)// write bytes into the streamawait stream.write(Uint8Array.from([0, 1, 2, 3, 4]))
This module makes it easy to send and receive bytes over streams.
Example