This module makes it easy to send and receive length-prefixed CBOR encoded messages over streams.
import { cborStream } from 'it-cbor-stream'import { MessageType } from './src/my-message-type.js'const stream = cborStream(duplex)// write a message to the streamstream.write({ foo: 'bar'})// read a message from the streamconst res = await stream.read() Copy
import { cborStream } from 'it-cbor-stream'import { MessageType } from './src/my-message-type.js'const stream = cborStream(duplex)// write a message to the streamstream.write({ foo: 'bar'})// read a message from the streamconst res = await stream.read()
This module makes it easy to send and receive length-prefixed CBOR encoded messages over streams.
Example