mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +00:00
Adds APIs for creating and extracting tar archives.
Bun.tarball() creates tar/tar.gz archives from objects:
- files: Record<string, string | Blob | BunFile | Buffer>
- compress: "gzip" | { type: "gzip", level: 0-9 }
- destination: optional path to write archive to disk
Bun.extract() extracts tar/tar.gz archives:
- from Blob, BunFile, Buffer, or file path
- to memory (returns Record<string, Blob>)
- or to disk with destination option
- skipPathComponents: strip N leading path components
Implementation:
- Uses libarchive for tar handling
- TarballJob: 207 lines
- ExtractJob: 205 lines (reuses Archiver.extractToDir for disk)
- Zero comments, production-quality code
- Proper memory ownership via Blob.Store
- All 33 tests passing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>