pub struct EntryOptions {
pub mtime: SystemTime,
pub permissions: Option<u32>,
pub uid_gid: Option<(u32, u32)>,
pub comment: Option<String>,
}Expand description
Per-entry options for appending to a ZIP archive.
Passed to ZipWriter::append_file,
ZipWriter::append_directory,
and ZipWriter::append_symlink
to control metadata such as
modification time, Unix permissions, UID/GID, and file comment.
Use the convenience constructors for common cases:
file— 0644 + current timedirectory— 0755 + current timesymlink— 0777 + current timefrom_path— read metadata from a real file
For full control, construct the struct directly:
use async_deflate_zip::EntryOptions;
use std::time::SystemTime;
let opts = EntryOptions {
mtime: SystemTime::UNIX_EPOCH,
permissions: Some(0o755),
uid_gid: Some((1000, 1000)),
comment: Some("my file".to_string()),
};Fields§
§mtime: SystemTimeLast modification time. Stored in MS-DOS format in the fixed CD fields and as a Unix timestamp in the extended timestamp extra field (0x5455).
permissions: Option<u32>Unix permission bits (e.g. 0o644, 0o755). The file type bit
(S_IFREG/S_IFDIR/S_IFLNK) is added automatically by the writer.
When None, no Unix permissions are written.
uid_gid: Option<(u32, u32)>Unix user and group IDs. Stored in the 0x7875 (Ux) extra field.
comment: Option<String>Per-entry comment stored in the Central Directory.
Maximum length is 65535 bytes. Comments longer than this will
cause finalize to return ZipError::FieldTooLong.
Implementations§
Source§impl EntryOptions
impl EntryOptions
Sourcepub async fn from_path<T: AsRef<Path>>(path: T) -> Result<Self>
pub async fn from_path<T: AsRef<Path>>(path: T) -> Result<Self>
Read metadata (mtime, permissions, uid/gid) from a real filesystem path.
The file’s content is not read — only symlink_metadata is queried
so this works on symlinks, directories, and regular files alike.
On Unix, permission bits are extracted from the file’s mode and
UID/GID from the file’s owner. On non-Unix platforms, permissions
default to None and UID/GID to None.
Sourcepub fn file() -> Self
pub fn file() -> Self
Convenience options for a regular file: permissions 0o644,
modification time set to now.