hildjj / node-cbor

Encode and decode CBOR documents, with both easy mode, streaming mode, and SAX-style evented mode.
MIT License
356 stars 73 forks source link

Encode error when source is too large #170

Open 203Null opened 2 years ago

203Null commented 2 years ago

image When the file length exceeds a size of around 16KB. the encoded data does will not increase anymore. The data generated is corrupted and can not be decoded.

203Null commented 2 years ago

The default "highWaterMark" of noFilter is 16384 and it overflowed. Need an option to change it

hildjj commented 2 years ago

https://github.com/hildjj/node-cbor/tree/main/packages/cbor#highwatermark

If this needs anything else let me know.

203Null commented 2 years ago

https://github.com/hildjj/node-cbor/tree/main/packages/cbor#highwatermark

If this needs anything else let me know.

Thank you, probably should have checked cbor repo. However I think it might be good to raise a warning when overflow.

hildjj commented 2 years ago

I'd take a patch for that, but I'm not sure it's easy to figure out the difference when you're in streaming mode and the backpressure is valid.