Versions in this module Expand all Collapse all v0 v0.1.3 Sep 25, 2026 v0.1.2 Sep 25, 2026 v0.1.1 Sep 25, 2026 v0.1.0 Sep 25, 2026 Changes in this version + const ZipMethodBzip2 + const ZipMethodXz + const ZipMethodZstd + var NoMatch = fmt.Errorf("no formats matched") + func FileSystem(ctx context.Context, filename string, stream ReaderAtSeeker) (fs.FS, error) + func PathContainsArchive(path string) bool + func PathIsArchive(path string) bool + func RegisterFormat(format Format) + func TopDirOpen(fsys fs.FS, name string) (fs.File, error) + func TopDirReadDir(fsys fs.FS, name string) ([]fs.DirEntry, error) + func TopDirStat(fsys fs.FS, name string) (fs.FileInfo, error) + type Archival interface + type ArchiveAsyncJob struct + File FileInfo + Result chan<- error + type ArchiveFS struct + Context context.Context + Format Extractor + Path string + Prefix string + Stream *io.SectionReader + func (f *ArchiveFS) ReadDir(name string) ([]fs.DirEntry, error) + func (f *ArchiveFS) Sub(dir string) (fs.FS, error) + func (f ArchiveFS) Open(name string) (fs.File, error) + func (f ArchiveFS) Stat(name string) (fs.FileInfo, error) + type Archiver interface + Archive func(ctx context.Context, output io.Writer, files []FileInfo) error + type ArchiverAsync interface + ArchiveAsync func(ctx context.Context, output io.Writer, jobs <-chan ArchiveAsyncJob) error + type Brotli struct + Quality int + func (Brotli) Extension() string + func (Brotli) MediaType() string + func (Brotli) OpenReader(r io.Reader) (io.ReadCloser, error) + func (br Brotli) Match(ctx context.Context, filename string, stream io.Reader) (MatchResult, error) + func (br Brotli) OpenWriter(w io.Writer) (io.WriteCloser, error) + type Bz2 struct + CompressionLevel int + func (Bz2) Extension() string + func (Bz2) MediaType() string + func (Bz2) OpenReader(r io.Reader) (io.ReadCloser, error) + func (bz Bz2) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + func (bz Bz2) OpenWriter(w io.Writer) (io.WriteCloser, error) + type CompressedArchive struct + func (ca CompressedArchive) Archive(ctx context.Context, output io.Writer, files []FileInfo) error + func (ca CompressedArchive) ArchiveAsync(ctx context.Context, output io.Writer, jobs <-chan ArchiveAsyncJob) error + func (ca CompressedArchive) Extension() string + func (ca CompressedArchive) Extract(ctx context.Context, sourceArchive io.Reader, handleFile FileHandler) error + func (ca CompressedArchive) Match(ctx context.Context, filename string, stream io.Reader) (MatchResult, error) + func (ca CompressedArchive) MediaType() string + type Compression interface + type Compressor interface + OpenWriter func(w io.Writer) (io.WriteCloser, error) + type Decompressor interface + OpenReader func(r io.Reader) (io.ReadCloser, error) + type DeepFS struct + Context context.Context + Root string + func (*DeepFS) SplitPath(path string) (realPath, innerPath string) + func (fsys *DeepFS) Open(name string) (fs.File, error) + func (fsys *DeepFS) ReadDir(name string) ([]fs.DirEntry, error) + func (fsys *DeepFS) Stat(name string) (fs.FileInfo, error) + type DirFS string + func (d DirFS) Open(name string) (fs.File, error) + func (d DirFS) ReadDir(name string) ([]fs.DirEntry, error) + func (d DirFS) Stat(name string) (fs.FileInfo, error) + func (d DirFS) Sub(dir string) (fs.FS, error) + type Extraction interface + type Extractor interface + Extract func(ctx context.Context, archive io.Reader, handleFile FileHandler) error + type FileFS struct + Compression Decompressor + Name string + Path string + func (f FileFS) Open(name string) (fs.File, error) + func (f FileFS) ReadDir(name string) ([]fs.DirEntry, error) + func (f FileFS) Stat(name string) (fs.FileInfo, error) + type FileHandler func(ctx context.Context, info FileInfo) error + type FileInfo struct + Header any + LinkTarget string + NameInArchive string + Open func() (fs.File, error) + func FilesFromDisk(ctx context.Context, options *FromDiskOptions, filenames map[string]string) ([]FileInfo, error) + func FilesFromFS(ctx context.Context, fsys fs.FS, options *FromFSOptions, ...) ([]FileInfo, error) + func (f FileInfo) Stat() (fs.FileInfo, error) + type Format interface + Extension func() string + Match func(ctx context.Context, filename string, stream io.Reader) (MatchResult, error) + MediaType func() string + func Identify(ctx context.Context, filename string, stream io.Reader) (Format, io.Reader, error) + type FromDiskOptions struct + ClearAttributes bool + FollowSymlinks bool + type FromFSOptions struct + ClearAttributes bool + FollowSymlinks bool + type Gz struct + CompressionLevel int + DisableMultistream bool + Multithreaded bool + func (Gz) Extension() string + func (Gz) MediaType() string + func (gz Gz) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + func (gz Gz) OpenReader(r io.Reader) (io.ReadCloser, error) + func (gz Gz) OpenWriter(w io.Writer) (io.WriteCloser, error) + type Inserter interface + Insert func(ctx context.Context, archive io.ReadWriteSeeker, files []FileInfo) error + type Lz4 struct + CompressionLevel int + func (Lz4) Extension() string + func (Lz4) MediaType() string + func (Lz4) OpenReader(r io.Reader) (io.ReadCloser, error) + func (lz Lz4) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + func (lz Lz4) OpenWriter(w io.Writer) (io.WriteCloser, error) + type Lzip struct + func (Lzip) Extension() string + func (Lzip) MediaType() string + func (Lzip) OpenReader(r io.Reader) (io.ReadCloser, error) + func (Lzip) OpenWriter(w io.Writer) (io.WriteCloser, error) + func (lz Lzip) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + type MatchResult struct + ByName bool + ByStream bool + func (mr MatchResult) Matched() bool + func (mr MatchResult) String() string + type MinLZ struct + func (MinLZ) Extension() string + func (MinLZ) MediaType() string + func (MinLZ) OpenReader(r io.Reader) (io.ReadCloser, error) + func (MinLZ) OpenWriter(w io.Writer) (io.WriteCloser, error) + func (mz MinLZ) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + type Rar struct + ContinueOnError bool + FS fs.FS + Name string + Password string + func (Rar) Extension() string + func (Rar) MediaType() string + func (r Rar) Extract(ctx context.Context, sourceArchive io.Reader, handleFile FileHandler) error + func (r Rar) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + type ReaderAtSeeker interface + type S2 struct + AddIndex bool + AllocBlock int + BlockSize int + Compression S2Level + Concurrency int + FlushOnWrite bool + IgnoreCRC bool + IgnoreStreamIdentifier bool + MaxBlockSize int + Padding int + SnappyIncompatible bool + type S2Level int + const S2LevelBest + const S2LevelBetter + const S2LevelFast + const S2LevelNone + type SevenZip struct + ContinueOnError bool + Password string + Solid bool + func (SevenZip) Extension() string + func (SevenZip) MediaType() string + func (z SevenZip) Archive(ctx context.Context, output io.Writer, files []FileInfo) error + func (z SevenZip) Extract(ctx context.Context, sourceArchive io.Reader, handleFile FileHandler) error + func (z SevenZip) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + type Sz struct + S2 S2 + func (Sz) Extension() string + func (Sz) MediaType() string + func (sz Sz) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + func (sz Sz) OpenReader(r io.Reader) (io.ReadCloser, error) + func (sz Sz) OpenWriter(w io.Writer) (io.WriteCloser, error) + type Tar struct + ContinueOnError bool + Format tar.Format + FormatGNU bool + Gid int + Gname string + NumericUIDGID bool + Uid int + Uname string + func (Tar) Extension() string + func (Tar) MediaType() string + func (t Tar) Archive(ctx context.Context, output io.Writer, files []FileInfo) error + func (t Tar) ArchiveAsync(ctx context.Context, output io.Writer, jobs <-chan ArchiveAsyncJob) error + func (t Tar) Extract(ctx context.Context, sourceArchive io.Reader, handleFile FileHandler) error + func (t Tar) Insert(ctx context.Context, into io.ReadWriteSeeker, files []FileInfo) error + func (t Tar) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + type Xz struct + func (Xz) Extension() string + func (Xz) MediaType() string + func (Xz) OpenReader(r io.Reader) (io.ReadCloser, error) + func (Xz) OpenWriter(w io.Writer) (io.WriteCloser, error) + func (x Xz) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + type Zip struct + Compression uint16 + ContinueOnError bool + SelectiveCompression bool + TextEncoding encoding.Encoding + func (Zip) Extension() string + func (Zip) MediaType() string + func (z Zip) Archive(ctx context.Context, output io.Writer, files []FileInfo) error + func (z Zip) ArchiveAsync(ctx context.Context, output io.Writer, jobs <-chan ArchiveAsyncJob) error + func (z Zip) Extract(ctx context.Context, sourceArchive io.Reader, handleFile FileHandler) error + func (z Zip) Insert(ctx context.Context, into io.ReadWriteSeeker, files []FileInfo) error + func (z Zip) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + type Zlib struct + CompressionLevel int + func (Zlib) Extension() string + func (Zlib) MediaType() string + func (Zlib) OpenReader(r io.Reader) (io.ReadCloser, error) + func (zz Zlib) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + func (zz Zlib) OpenWriter(w io.Writer) (io.WriteCloser, error) + type Zstd struct + DecoderOptions []zstd.DOption + EncoderOptions []zstd.EOption + func (Zstd) Extension() string + func (Zstd) MediaType() string + func (zs Zstd) Match(_ context.Context, filename string, stream io.Reader) (MatchResult, error) + func (zs Zstd) OpenReader(r io.Reader) (io.ReadCloser, error) + func (zs Zstd) OpenWriter(w io.Writer) (io.WriteCloser, error)