Implementation of an alternative Builder which impl io::Read#316
Open
ph0llux wants to merge 9 commits into
Open
Implementation of an alternative Builder which impl io::Read#316ph0llux wants to merge 9 commits into
ph0llux wants to merge 9 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi,
I have implemented an alternative Builder (I've named it "Streamer", but I'm not very good at such naming, so feel free to suggest something more appropriate 😄 ) which implements io::Read.
How does it work?
You build a streamer, then add your stuff (e.g. some paths to files) and then "read" the archive. You don't need an underlying writer, you can use it directly as a reader.
Here is a code example:
The biggest question: Why?
Yes... my personal use case was the use of the Rocket-library - I had to build a TAR archive from some files which are on a web server and then offer that directly for download.
Since the files are very large, I always had to "write" the tar archive to the web server first and then I could offer it for download.
With the streamer I can offer it directly as a data stream and let it "build on-the-fly" during the download.
But there may be other use-cases, also.
When will I get an I/O error?
Mostly while reading the archive.
Additional Notes