Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@ impl<W: Write> Builder<W> {
self.append(&header, data)
}

/// Add a file entry to the archive.
///
/// This function will create a header for a file of correct size, mode, and checksum.
Comment on lines +187 to +189

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.

pub fn append_file_data<P: AsRef<Path>>(
&mut self,
path: P,
mode: u32,
data: &[u8],
) -> io::Result<()> {
let mut header = Header::new_gnu();
header.set_size(data.len() as u64);
header.set_mode(mode);
header.set_cksum();
self.append_data(&mut header, path, data)
}

/// Adds a new entry to this archive and returns an [`EntryWriter`] for
/// adding its contents.
///
Expand Down