Documentation
¶
Index ¶
- func Pack(ctx context.Context, fsys virefs.FS, keys []string, w io.Writer) (retErr error)
- func Unpack(ctx context.Context, r io.ReaderAt, size int64, dst virefs.FS, prefix string, ...) error
- type FS
- func (z *FS) Access(_ context.Context, key string) (*virefs.AccessInfo, error)
- func (z *FS) Close() error
- func (z *FS) Delete(_ context.Context, key string) error
- func (z *FS) Exists(_ context.Context, key string) (bool, error)
- func (z *FS) Get(_ context.Context, key string) (io.ReadCloser, error)
- func (z *FS) List(_ context.Context, prefix string) (*virefs.ListResult, error)
- func (z *FS) Put(_ context.Context, key string, _ io.Reader, _ ...virefs.PutOption) error
- func (z *FS) Stat(_ context.Context, key string) (*virefs.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pack ¶
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 ¶
NewFS creates a read-only FS from an io.ReaderAt. The caller is responsible for the lifetime of ra.
func NewFSFromBytes ¶
NewFSFromBytes creates a read-only FS from in-memory bytes.
func OpenFS ¶
OpenFS opens a zip file at filePath and returns a read-only FS. The caller must call Close when done.