denoland / std

The Deno Standard Library
https://jsr.io/@std
MIT License
2.99k stars 596 forks source link

suggestion: add CBOR encoding/decoding #5479

Open benatkin opened 1 month ago

benatkin commented 1 month ago

Deno's stdlib has msgpack support. msgpack and CBOR each have pros and cons compared to each other, but this limitation is what gives me the desire to have CBOR:

maximum byte size of a String object is (2^32)-1

A CBOR implementation alongside msgpack here.

Describe alternatives you've considered

There are third party libraries, but this is something I'd like to see in the standard library.

Another nice thing about CBOR is its support for indefinite length items which is good for streaming.

BlackAsLight commented 1 month ago

For the record, CBOR is still streamable with definite length items. Indefinite length items are for streaming content when you don't know the size before starting. Like applying compression algorithm to some data or converting a file format from one type to another.

benatkin commented 1 month ago

Streaming implementations already in @std:

Also looked at the state of DOMParser: