zip

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pack

func Pack(ctx context.Context, fsys virefs.FS, keys []string, w io.Writer) (retErr error)

Pack reads the listed keys from fsys and writes them into a zip archive streamed to w. Keys are used as entry names inside the archive after normalisation via virefs.CleanKey.

func Unpack

func Unpack(ctx context.Context, r io.ReaderAt, size int64, dst virefs.FS, prefix string, opts ...virefs.PutOption) error

Unpack reads a zip archive from r and writes every file entry into dst under the given prefix. Directory entries are skipped. Each entry name is normalised via virefs.CleanKey before being joined with prefix.

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

FS is a read-only virefs.FS backed by a zip archive. Put, Delete and Access always return virefs.ErrNotSupported.

func NewFS

func NewFS(ra io.ReaderAt, size int64) (*FS, error)

NewFS creates a read-only FS from an io.ReaderAt. The caller is responsible for the lifetime of ra.

func NewFSFromBytes

func NewFSFromBytes(data []byte) (*FS, error)

NewFSFromBytes creates a read-only FS from in-memory bytes.

func OpenFS

func OpenFS(filePath string) (*FS, error)

OpenFS opens a zip file at filePath and returns a read-only FS. The caller must call Close when done.

func (*FS) Access

func (z *FS) Access(_ context.Context, key string) (*virefs.AccessInfo, error)

Access implements virefs.FS. Always returns ErrNotSupported.

func (*FS) Close

func (z *FS) Close() error

Close releases the underlying file handle if one was opened by OpenFS.

func (*FS) Delete

func (z *FS) Delete(_ context.Context, key string) error

Delete implements virefs.FS. Always returns ErrNotSupported.

func (*FS) Exists added in v0.1.1

func (z *FS) Exists(_ context.Context, key string) (bool, error)

Exists implements virefs.FS.

func (*FS) Get

func (z *FS) Get(_ context.Context, key string) (io.ReadCloser, error)

Get implements virefs.FS.

func (*FS) List

func (z *FS) List(_ context.Context, prefix string) (*virefs.ListResult, error)

List implements virefs.FS.

func (*FS) Put

func (z *FS) Put(_ context.Context, key string, _ io.Reader, _ ...virefs.PutOption) error

Put implements virefs.FS. Always returns ErrNotSupported.

func (*FS) Stat

func (z *FS) Stat(_ context.Context, key string) (*virefs.FileInfo, error)

Stat implements virefs.FS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL