This module makes it easy to send and receive ndjson messages over streams.
import { ndjsonStream } from 'it-ndjson-stream'const stream = ndjsonStream(duplex)// read the next messageconst obj = await stream.read()// write a messageawait stream.write({ hello: 'world' })// write several messagesawait stream.writeV([ { hello: 'world' }, { how: 'are you' }]) Copy
import { ndjsonStream } from 'it-ndjson-stream'const stream = ndjsonStream(duplex)// read the next messageconst obj = await stream.read()// write a messageawait stream.write({ hello: 'world' })// write several messagesawait stream.writeV([ { hello: 'world' }, { how: 'are you' }])
This module makes it easy to send and receive ndjson messages over streams.
Example