storage

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileSize

func FileSize(path string) (int64, error)

FileSize is an utility to calculate dimension of file to upload

func ZipArchive

func ZipArchive(zipname string, files ...string) error

ZipArchive creates a zipfile (this function allows only for absolute paths)

Types

type Config

type Config struct {
	Provider             string `json:"provider"               mapstructure:"provider"`
	AccessKey            string `json:"aws_access_key"         mapstructure:"aws_access_key"`
	SecretKey            string `json:"aws_secret_key"         mapstructure:"aws_secret_key"`
	AzureStorageAccount  string `json:"azure_storage_account"  mapstructure:"azure_storage_account"`
	AzureStorageKey      string `json:"azure_storage_key"      mapstructure:"azure_storage_key"`
	GoogleServiceAccount string `json:"google_service_account" mapstructure:"google_service_account"`
	GoogleProjectId      string `json:"google_project_id"      mapstructure:"google_project_id"`
	URL                  string `json:"url"                    mapstructure:"url"`
	Region               string `json:"region"                 mapstructure:"region"`
	BucketName           string `json:"bucketName"             mapstructure:"bucketName"`
	LocalPath            string `json:"path"                   mapstructure:"path"`
}

Config represent a configuration for working with an object storage

type Data

type Data struct {
	// contains filtered or unexported fields
}

Data represent where to put whatever you're downloading

func Init

func Init(cfg *Config) (*Data, error)

Init tests the credentials, the write access and list access

func (*Data) Close

func (s *Data) Close() error

Close closes the open connection to the remote or local stow.Location

func (*Data) Download

func (s *Data) Download(filename string, obj io.WriteCloser) error

Download is the single interface to download something from Object Storage

func (*Data) DownloadFilesToDirectory

func (store *Data) DownloadFilesToDirectory(files [][]string, localDir, fromPath string, overwrite bool) error

func (*Data) DownloadFilesToMemory added in v0.1.0

func (store *Data) DownloadFilesToMemory(files []string, fromPath string) (map[string][]byte, error)

func (*Data) Exists added in v0.1.0

func (s *Data) Exists(filename string) bool

Exists is the single interface to check for file existence from Object Storage

func (*Data) List added in v0.2.0

func (s *Data) List(dir string) ([]string, error)

List is the single interface to List a file in a specified directory

func (*Data) Move added in v0.1.0

func (s *Data) Move(filename, src, dest string) error

Move moves the file from its current location to the given path

func (*Data) Remove added in v0.1.0

func (s *Data) Remove(filename string) error

Remove removes the filename with the given path

func (*Data) Upload

func (s *Data) Upload(filename string, size int64, obj io.ReadCloser) error

Upload is the single interface to upload something to Object Storage

func (*Data) UploadFile

func (s *Data) UploadFile(filename, localPath string) error

func (*Data) UploadFileForce

func (s *Data) UploadFileForce(filename, localPath string) error

func (*Data) UploadFilesFromDirectory

func (store *Data) UploadFilesFromDirectory(files [][]string, localDir, toPath string) error

func (*Data) UploadFilesFromDirectoryWithForce

func (store *Data) UploadFilesFromDirectoryWithForce(files [][]string, localDir, toPath string) error

func (*Data) UploadFilesFromMemory

func (store *Data) UploadFilesFromMemory(files map[string][]byte, dir string) error

func (*Data) UploadForce

func (s *Data) UploadForce(filename string, size int64, obj io.ReadCloser) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL