be

package
v0.0.0-...-b8c4203 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFileExtension

func ExtractFileExtension(filePath string) (string, error)

ExtractFileExtension extracts the file extension from a file path

func ExtractFileName

func ExtractFileName(filePath string) (string, error)

ExtractFileName extracts the name of the file from a file path.

func SaveFileLocally

func SaveFileLocally(filePath string, data []byte) error

SaveFileLocally writes the data to the specified local path

Types

type StorjClient

type StorjClient interface {
	UploadObject(ctx context.Context, bucket, key string, options *uplink.UploadOptions) (*uplink.Upload, error)
	DownloadObject(ctx context.Context, bucket, key string, options *uplink.DownloadOptions) (*uplink.Download, error)
	DeleteObject(ctx context.Context, bucket, key string) (*uplink.Object, error)
}

StorjClient encapsulates the methods from uplink.Project that are used.

type StorjService

type StorjService struct {
	Client StorjClient
}

func NewStorjService

func NewStorjService(secret string) (*StorjService, error)

func (*StorjService) AddFile

func (s *StorjService) AddFile(bucketName string, pathStorj string, pathFile string) error

AddFile uploads a file to the specified path in the Storj bucket

func (*StorjService) AddFileBytes

func (s *StorjService) AddFileBytes(bucketName string, pathStorj string, content []byte) error

AddFileBytes uploads a file,writing on file bytes, to the specified path in the Storj bucket

func (*StorjService) DeleteFile

func (s *StorjService) DeleteFile(bucketName string, pathStorj string) error

DeleteFile deletes a file from the specified path in the Storj bucket

func (*StorjService) GetFile

func (s *StorjService) GetFile(bucketName string, pathStorj string) ([]byte, error)

GetFile downloads a file from the specified path in the Storj bucket

Jump to

Keyboard shortcuts

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