Documentation ¶
Overview ¶
Package storagearchive implements archive utilities.
Index ¶
- Variables
- func Tar(ctx context.Context, readBucket storage.ReadBucket, writer io.Writer) (retErr error)
- func Untar(ctx context.Context, reader io.Reader, writeBucket storage.WriteBucket, ...) error
- func Unzip(ctx context.Context, readerAt io.ReaderAt, size int64, ...) error
- func Zip(ctx context.Context, readBucket storage.ReadBucket, writer io.Writer, ...) (retErr error)
- type UntarOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFileSizeLimit is returned when file read limit is reached. // // See [WithMaxFileSizeUntarOption] ErrFileSizeLimit = errors.New("file size exceeded read limit") )
Functions ¶
func Tar ¶
Tar tars the given bucket to the writer.
Only regular files are added to the writer. All files are written as 0644.
func Untar ¶
func Untar( ctx context.Context, reader io.Reader, writeBucket storage.WriteBucket, mapper storage.Mapper, stripComponentCount uint32, opts ...UntarOption, ) error
Untar untars the given tar archive from the reader into the bucket.
Only regular files are added to the bucket.
Paths from the tar archive will be mapped before adding to the bucket. Mapper can be nil. StripComponents happens before the mapper.
func Unzip ¶
func Unzip( ctx context.Context, readerAt io.ReaderAt, size int64, writeBucket storage.WriteBucket, mapper storage.Mapper, stripComponentCount uint32, ) error
Unzip unzips the given zip archive from the reader into the bucket.
Only regular files are added to the bucket.
Paths from the zip archive will be mapped before adding to the bucket. Mapper can be nil. StripComponents happens before the mapper.
Types ¶
type UntarOption ¶
type UntarOption interface {
// contains filtered or unexported methods
}
UntarOption is an option for Untar.
func WithMaxFileSizeUntarOption ¶
func WithMaxFileSizeUntarOption(size int) UntarOption
WithMaxFileSizeUntarOption returns an option that limits the maximum size