Versions in this module Expand all Collapse all v4 v4.0.1 Jul 4, 2023 Changes in this version + const ZipMethodBzip2 + const ZipMethodXz + const ZipMethodZstd + var ErrNoMatch = fmt.Errorf("no formats matched") + var ZlibHeader = []byte + func FileSystem(ctx context.Context, root string) (fs.FS, error) + 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 File + Result chan<- error + type ArchiveFS struct + Context context.Context + Format Archival + Path string + Prefix string + Stream *io.SectionReader + func (f *ArchiveFS) Sub(dir string) (fs.FS, error) + func (f ArchiveFS) Open(name string) (fs.File, error) + func (f ArchiveFS) ReadDir(name string) ([]fs.DirEntry, error) + func (f ArchiveFS) Stat(name string) (fs.FileInfo, error) + type Archiver interface + Archive func(ctx context.Context, output io.Writer, files []File) error + type ArchiverAsync interface + ArchiveAsync func(ctx context.Context, output io.Writer, jobs <-chan ArchiveAsyncJob) error + type Brotli struct + Quality int + func (Brotli) Name() string + func (Brotli) OpenReader(r io.Reader) (io.ReadCloser, error) + func (br Brotli) Match(filename string, stream io.Reader) (MatchResult, error) + func (br Brotli) OpenWriter(w io.Writer) (io.WriteCloser, error) + type Bz2 struct + CompressionLevel int + func (Bz2) Name() string + func (Bz2) OpenReader(r io.Reader) (io.ReadCloser, error) + func (bz Bz2) Match(filename string, stream io.Reader) (MatchResult, error) + func (bz Bz2) OpenWriter(w io.Writer) (io.WriteCloser, error) + type CompressedArchive struct + func (caf CompressedArchive) Archive(ctx context.Context, output io.Writer, files []File) error + func (caf CompressedArchive) ArchiveAsync(ctx context.Context, output io.Writer, jobs <-chan ArchiveAsyncJob) error + func (caf CompressedArchive) Extract(ctx context.Context, sourceArchive io.Reader, pathsInArchive []string, ...) error + func (caf CompressedArchive) Match(filename string, stream io.Reader) (MatchResult, error) + func (caf CompressedArchive) Name() 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 DirFS string + func (f DirFS) Open(name string) (fs.File, error) + func (f DirFS) ReadDir(name string) ([]fs.DirEntry, error) + func (f DirFS) Stat(name string) (fs.FileInfo, error) + func (f DirFS) Sub(dir string) (fs.FS, error) + type Extractor interface + Extract func(ctx context.Context, sourceArchive io.Reader, pathsInArchive []string, ...) error + type File struct + Header interface{} + LinkTarget string + NameInArchive string + Open func() (io.ReadCloser, error) + func FilesFromDisk(options *FromDiskOptions, filenames map[string]string) ([]File, error) + func (f File) Stat() (fs.FileInfo, error) + type FileFS struct + Compression Decompressor + 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, f File) error + type Format interface + Match func(filename string, stream io.Reader) (MatchResult, error) + Name func() string + func Identify(filename string, stream io.Reader) (Format, io.Reader, error) + type FromDiskOptions struct + ClearAttributes bool + FollowSymlinks bool + type Gz struct + CompressionLevel int + Multithreaded bool + func (Gz) Name() string + func (gz Gz) Match(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 []File) error + type Lz4 struct + CompressionLevel int + func (Lz4) Name() string + func (Lz4) OpenReader(r io.Reader) (io.ReadCloser, error) + func (lz Lz4) Match(filename string, stream io.Reader) (MatchResult, error) + func (lz Lz4) OpenWriter(w io.Writer) (io.WriteCloser, error) + type MatchResult struct + ByName bool + ByStream bool + func (mr MatchResult) Matched() bool + type Rar struct + ContinueOnError bool + Password string + func (Rar) Name() string + func (r Rar) Archive(_ context.Context, _ io.Writer, _ []File) error + func (r Rar) Extract(ctx context.Context, sourceArchive io.Reader, pathsInArchive []string, ...) error + func (r Rar) Match(filename string, stream io.Reader) (MatchResult, error) + type SevenZip struct + ContinueOnError bool + Password string + func (z SevenZip) Archive(_ context.Context, _ io.Writer, _ []File) error + func (z SevenZip) Extract(ctx context.Context, sourceArchive io.Reader, pathsInArchive []string, ...) error + func (z SevenZip) Match(filename string, stream io.Reader) (MatchResult, error) + func (z SevenZip) Name() string + type Sz struct + func (Sz) OpenReader(r io.Reader) (io.ReadCloser, error) + func (Sz) OpenWriter(w io.Writer) (io.WriteCloser, error) + func (sz Sz) Match(filename string, stream io.Reader) (MatchResult, error) + func (sz Sz) Name() string + type Tar struct + ContinueOnError bool + func (Tar) Name() string + func (t Tar) Archive(ctx context.Context, output io.Writer, files []File) 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, pathsInArchive []string, ...) error + func (t Tar) Insert(ctx context.Context, into io.ReadWriteSeeker, files []File) error + func (t Tar) Match(filename string, stream io.Reader) (MatchResult, error) + type Xz struct + func (Xz) Name() string + func (Xz) OpenReader(r io.Reader) (io.ReadCloser, error) + func (Xz) OpenWriter(w io.Writer) (io.WriteCloser, error) + func (x Xz) Match(filename string, stream io.Reader) (MatchResult, error) + type Zip struct + Compression uint16 + ContinueOnError bool + SelectiveCompression bool + TextEncoding string + func (z Zip) Archive(ctx context.Context, output io.Writer, files []File) 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, pathsInArchive []string, ...) error + func (z Zip) Match(filename string, stream io.Reader) (MatchResult, error) + func (z Zip) Name() string + type Zlib struct + CompressionLevel int + func (Zlib) Name() string + func (Zlib) OpenReader(r io.Reader) (io.ReadCloser, error) + func (zz Zlib) Match(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) Name() string + func (zs Zstd) Match(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) Other modules containing this package github.com/mel2oo/archiver