API Reference
tar
A Rust library for reading and writing tar archives, used by cargo and many build tools.
Official Documentation ↗CompatibilityThis documentation covers version
v0.4. Check the official docs for the latest API surface.Installation
cargo
cargo add tarMethods
No methods match this filter.
tar reads and writes the tar format, with helpers to unpack into a directory or build from files.
Key Features
- Read and write tar archives
- Unpack with path safety
- Builder for creating archives
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Security notes
Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://docs.rs/tar/latest/tar/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:52:50.141Z.
- When extracting untrusted archives in an environment where the destination may be concurrently modified, use the cap-std crate and/or OS-level sandboxing. (https://docs.rs/tar/latest/tar/)
FAQ
- Is unpack safe against path traversal?
- It guards against entries escaping the destination, but still unpack untrusted archives only in a sandboxed location.
- How do I read entries without unpacking?
- Iterate archive.entries() and inspect each entry path and type before deciding to extract.
- How do I create gzip archives?
- Combine tar with flate2: wrap the writer in a GzEncoder before passing it to the Builder.
Report a problem with this API docOpens a pre-filled issue on GitHub.