Skip to content

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

Open
KSXGitHub wants to merge 1 commit into
composefs:mainfrom
KSXGitHub:append-file-data
Open

Request: Function to add files from in-memory data#400
KSXGitHub wants to merge 1 commit into
composefs:mainfrom
KSXGitHub:append-file-data

Conversation

@KSXGitHub
Copy link
Copy Markdown
Contributor

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 thread src/builder.rs
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
Copy Markdown
Contributor 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