buf: github.com/bufbuild/buf/internal/pkg/storage/storageutil Index | Files

package storageutil

import "github.com/bufbuild/buf/internal/pkg/storage/storageutil"

Package storageutil implements storage utilities.

Index

Package Files

storageutil.go

func Copy Uses

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 Uses

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 Uses

func ReadPath(ctx context.Context, bucket storage.ReadBucket, path string) (_ []byte, retErr error)

ReadPath is analogous to ioutil.ReadFile.

Returns an error that fufills storage.IsNotExist if the path does not exist.

func Tar Uses

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 Uses

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 Uses

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 Uses

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.

Package storageutil imports 10 packages (graph). Updated 2019-12-14. Refresh now. Tools for package owners.