CBOR icon indicating copy to clipboard operation
CBOR copied to clipboard

Streaming parser API?

Open knutwannheden opened this issue 1 year ago • 0 comments

I would like to be able to use the CBOR parser as a tokenizer basically, so that I can parse a Stream (which gets its data from an underlying socket) into CBOR "tokens". The reason being that the document could contain some very large data structures (e.g. a very long array) and from what I can tell the current API would require reading the full array into memory into a corresponding CBORObject. In my case I would then copy the data from there into the application's own data structures and would thus temporarily lead to a lot of additional data being allocated (and also put more pressure on the GC).

.NET's own CBOR implementation provides a CBOR parser that can be used directly. Unfortunately it doesn't allow me to read data synchronously from a Stream, which is why I prefer to use this library. Now I am wondering how I should proceed when parsing very large arrays.

knutwannheden avatar May 04 '24 20:05 knutwannheden