Request: Function to add files from in-memory data#400
Open
KSXGitHub wants to merge 1 commit into
Open
Conversation
KSXGitHub
commented
Mar 2, 2025
Comment on lines
+187
to
+189
| /// Add a file entry to the archive. | ||
| /// | ||
| /// This function will create a header for a file of correct size, mode, and checksum. |
Contributor
Author
There was a problem hiding this comment.
This document is not as detailed as the other methods, but I don't know how to make it.
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.
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-rsdoesn't provide a convenient function to quickly add in-memory data to a tar archive as files.Why not
Builder::append_data?Constructing
Headeris too verbose and error-prone. As a consumer of this package, I had to various trials and errors to create a correctHeaderthat 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.