Documentation ¶
Index ¶
- func MD5file(url string) (string, error)
- func MD5fileBytes(url string) (hash []byte, err error)
- type Bucket
- func (b *Bucket) Attrs(filePath string) (attrs *storage.ObjectAttrs, err error)
- func (b *Bucket) CopyFile(src, dst string) error
- func (b *Bucket) CopyFolder(srcFolder, dstFolder string, multiple bool) error
- func (b *Bucket) Delete(filePath string) error
- func (b *Bucket) DeleteFolder(folder string) error
- func (b *Bucket) DeleteOldFiles(folder string, fileAge time.Duration) error
- func (b *Bucket) Download(src, dst string) error
- func (b *Bucket) Exists(filePath string) (bool, error)
- func (b *Bucket) GetFileReader(object string, optionalBucket ...string) (reader io.Reader, err error)
- func (b *Bucket) GetFolderSize(prefix string) (int64, error)
- func (b *Bucket) GetMeta(src string, optionalBucket ...string) (Meta, error)
- func (b *Bucket) GetSignedURL(objectPath string, duration time.Duration, optionalBucket ...string) (string, error)
- func (b *Bucket) Init(bucket string)
- func (b *Bucket) List(prefix string, limit int) (files []string, err error)
- func (b *Bucket) MD5(filePath string) (md5String string, err error)
- func (b *Bucket) MakePublic(filePath string) (downloadURL string, err error)
- func (b *Bucket) ReadFile(filepath string, obj interface{}) (err error)
- func (b *Bucket) Size(filePath string) (size int64, err error)
- func (b *Bucket) Upload(localFile, dst string) error
- func (b *Bucket) UploadFromReader(reader io.Reader, dst string, optionalBucket ...string) error
- func (b *Bucket) UploadVerify(localFile, dst string) error
- type Meta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MD5fileBytes ¶ added in v2.0.1
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
func (*Bucket) Attrs ¶
func (b *Bucket) Attrs(filePath string) (attrs *storage.ObjectAttrs, err error)
Attrs returns the metadata for the bucket.
func (*Bucket) CopyFolder ¶
CopyFolder copy cloud storage folder to another dst
func (*Bucket) DeleteFolder ¶
DeleteFolder delete all files under folder
func (*Bucket) DeleteOldFiles ¶
DeleteOldFiles delete files from folder based on their age, time from created date
func (*Bucket) GetFileReader ¶
func (b *Bucket) GetFileReader(object string, optionalBucket ...string) (reader io.Reader, err error)
GetFileReader get file reader from gcp bucket
func (*Bucket) GetFolderSize ¶ added in v2.0.2
GetFolderSize gets the size in bytes of a folder in the bucket
func (*Bucket) GetSignedURL ¶
func (b *Bucket) GetSignedURL(objectPath string, duration time.Duration, optionalBucket ...string) (string, error)
GetSignedURL get signed url with expire time
func (*Bucket) List ¶
List all files in a bucket with a prefix prefix can be a folder, if prefix is empty string the function will return all files in the bucket limit is number of files to retrive, 0 means all
func (*Bucket) MakePublic ¶
MakePublic make file public (readonly) and retrive the download url
func (*Bucket) UploadFromReader ¶
UploadFromReader upload from reader to GCP file
func (*Bucket) UploadVerify ¶ added in v2.0.1
UploadVerify local file to the current bucket and perform checksum after uploading