Add functions for stream encoding/decoding of big strings #133
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This may be useful i.e. when your service should download file and send it inside json to other service without storing whole file in memory.
In my case service downloads a file from S3-like service and makes request to our email provider to send it as attachment (base64 encoded).
Currently I'm using this snippet:
My changes allows to shorten it to this:
This PR adds similar methods for decoding (may be useful i.e. when you get response where file goes as base64-encoded string and this file should be uploaded to somewhere).
Side changes:
SetBufFlushThreshold
if target writer provided (to reduce memory consumption). Should close Periodically flush thebuf
to theWriter
. #78