Documentation ¶
Overview ¶
Package storageutil implements storage utilities.
Index ¶
- func Copy(ctx context.Context, from storage.ReadBucket, to storage.Bucket, prefix string, ...) (int, error)
- func CopyPaths(ctx context.Context, from storage.ReadBucket, to storage.Bucket, ...) (int, error)
- func ReadPath(ctx context.Context, bucket storage.ReadBucket, path string) (_ []byte, retErr error)
- func Tar(ctx context.Context, writer io.Writer, bucket storage.Bucket, prefix string, ...) error
- func Targz(ctx context.Context, writer io.Writer, bucket storage.Bucket, prefix string, ...) error
- func Untar(ctx context.Context, reader io.Reader, bucket storage.Bucket, ...) error
- func Untargz(ctx context.Context, reader io.Reader, bucket storage.Bucket, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
func Copy( ctx context.Context, from storage.ReadBucket, to storage.Bucket, prefix string, options ...storagepath.TransformerOption, ) (int, error)
Copy copies the bucket at from to the bucket at to for the given prefix.
Copies done concurrently.
Paths from the source bucket will be transformed before being added to the destination bucket. Returns the number of files copied.
func CopyPaths ¶
func CopyPaths( ctx context.Context, from storage.ReadBucket, to storage.Bucket, paths ...string, ) (int, error)
CopyPaths copies the paths from the bucket at from to the bucket at to, if they exist.
Paths will be normalized within this function. Copies done concurrently.
Returns the number of files copied.
func ReadPath ¶
ReadPath is analogous to ioutil.ReadFile.
Returns an error that fufills storage.IsNotExist if the path does not exist.
func Tar ¶
func Tar( ctx context.Context, writer io.Writer, bucket storage.Bucket, prefix string, options ...storagepath.TransformerOption, ) error
Tar tars the given bucket to the writer.
Only regular files are added to the writer. All files are written as 0644.
Paths from the bucket will be transformed before adding to the writer.
func Targz ¶
func Targz( ctx context.Context, writer io.Writer, bucket storage.Bucket, prefix string, options ...storagepath.TransformerOption, ) error
Targz tars and gzips the given bucket to the writer.
Only regular files are added to the writer. All files are written as 0644.
Paths from the bucket will be transformed before adding to the writer.
func Untar ¶
func Untar( ctx context.Context, reader io.Reader, bucket storage.Bucket, options ...storagepath.TransformerOption, ) 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 transformed before adding to the bucket.
func Untargz ¶
func Untargz( ctx context.Context, reader io.Reader, bucket storage.Bucket, options ...storagepath.TransformerOption, ) error
Untargz untars the given targz archive from the reader into the bucket.
Only regular files are added to the bucket.
Paths from the targz archive will be transformed before adding to the bucket.
Types ¶
This section is empty.