-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Description
What is the problem this feature will solve?
I have a CBOR parser that in Java and Python reads one byte at a time from a virtual stream (like C's fgetc).
With this system I can provide a stream pointing to memory or received via an HTTP response.
There is (AFAICT) no such feature in JavaScript or Nodejs making the JavaScript version of the CBOR parser a bit underwhelming.
I believe there are a lot of machine to machine solutions that could benefit from a simple blocking stream solution. Trivial in Python. HTTP version:
import http.client
conn = http.client.HTTPSConnection("cyberphone.github.io")
conn.request("GET", "/javaapi/app-notes/large-payloads/metadata.cbor")
response = conn.getresponse()
print(response.status, response.reason)
CBOR.init_decoder(response, 10000).decode_with_options()Memory buffer version:
CBOR.init_decoder(io.BytesIO(cbor_bytes), len(cbor_bytes)).decode_with_options()For the CBOR parser these constructs appear identical.
Advanced example using Java:
https://github.com/cyberphone/javaapi/tree/gh-pages/app-notes/large-payloads
What is the feature you are proposing to solve the problem?
Something along the lines above
What alternatives have you considered?
I'm not aware of any workarounds that would require a completely redesigned parser
Metadata
Metadata
Assignees
Labels
Type
Projects
Status