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

ndjson #19

Closed jbenet closed 8 years ago

jbenet commented 9 years ago

might be nice to have an -n option on the cbor2json and json2cbor tools to use streaming (with ndjson). See https://github.com/jbenet/node-ubjson-stream#streaming

hildjj commented 9 years ago

Can you say a little more about how you want those tools to act differently with -n? I'm assuming:

This should be pretty easy for cbor2json, but I'd rather not take another dependency in order to get streaming JSON input in json2cbor.

hildjj commented 9 years ago

Oh, also, I'm a little more interested in RFC 7464 (https://tools.ietf.org/html/rfc7464) as the JSON input.

jbenet commented 9 years ago
  • Don't stop reading after the first full object is read
  • still shut down on stdin EOF

Right.

I'd rather not take another dependency in order to get streaming JSON input in json2cbor.

I think https://github.com/maxogden/ndjson is not that bad of a dep.

https://github.com/jbenet/node-cbor/pull/1 is a possible example.

hildjj commented 8 years ago

Fixed in #22