Request: Function to add files from in-memory data #400
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.
Note
I am aware that this "PR" is not up to your standard. I just create a PR instead of an issue to better illustrate my feature request. Please consider this a feature request instead of a proper PR. If you have requests for change, feel free to edit this PR directly.
It's quite inconvenient that
tar-rs
doesn't provide a convenient function to quickly add in-memory data to a tar archive as files.Why not
Builder::append_data
?Constructing
Header
is too verbose and error-prone. As a consumer of this package, I had to various trials and errors to create a correctHeader
that would produce a valid tar file that can be parsed by other programs in my Linux machine.Why not
Builder::append_file
?This function requires reading a file from the filesystem, but my use case was data stored as
&[u8]
in-memory. To write this data to the filesystem then read it would be suboptimal.