Skip to content
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

Request: Function to add files from in-memory data #400

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KSXGitHub
Copy link

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 correct Header 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.

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.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document is not as detailed as the other methods, but I don't know how to make it.

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

Successfully merging this pull request may close these issues.

1 participant