Skip to content

Stream encoding #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
moeghassi opened this issue May 13, 2020 · 2 comments
Open

Stream encoding #146

moeghassi opened this issue May 13, 2020 · 2 comments

Comments

@moeghassi
Copy link

Has there been any work done to implement stream encoder?
I'm thinking of taking a look at it.

@PJK
Copy link
Owner

PJK commented May 14, 2020

Hi @mghicho, not really, but the current encoders can be used to encode e.g. an array or a map in a streaming manner by calling e.g. cbor_encode_indef_array_start and then encoding individual items and terminating, flushing buffers as needed. What would the API you have in mind look like?

@moeghassi
Copy link
Author

moeghassi commented Jun 27, 2020

Hi,
Sorry I somehow missed the notification that you replied.
I actually went with the same method your suggested, it was enough for my application.

But when I was exploring ideas, I thought of an api that you can feed it your json text in a streaming fashion, and receive whatever binary is prepared at that time, something like:

streaming_encode(
    char* jsonText,  ///< [IN]
    int jsonTextLength,   ///< [IN]
    uint8_t outBuffer,    ///<  [OUT]
    int* outBufferLengthPtr ///<  [OUT])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants