1.0.1 • Published 3 months ago
it-cbor-stream v1.0.1
it-cbor-stream
Read and write CBOR messages over a duplex stream
About
This module makes it easy to send and receive length-prefixed CBOR encoded messages over streams.
Example
import { cborStream } from 'it-cbor-stream'
import { MessageType } from './src/my-message-type.js'
const stream = cborStream(duplex)
// write a message to the stream
stream.write({
foo: 'bar'
})
// read a message from the stream
const res = await stream.read()
Install
$ npm i it-cbor-stream
Browser <script>
tag
Loading this module through a script tag will make its exports available as ItCborStream
in the global namespace.
<script src="https://unpkg.com/it-cbor-stream/dist/index.min.js"></script>
API Docs
License
Licensed under either of
- Apache 2.0, (LICENSE-APACHE / http://www.apache.org/licenses/LICENSE-2.0)
- MIT (LICENSE-MIT / http://opensource.org/licenses/MIT)
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.