gobs

package module
v0.0.0-...-66164de Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 7 Imported by: 0

README

gobs

Go obs client for huawei cloud OBS

Example
func TestRead(t *testing.T) {
	cli, err := gobs.NewOBS(accessKey, secretKey, endPoint, bucket)
	assert.Nil(t, err)
	r, err := cli.Read("texts/a.txt")
	assert.Nil(t, err)
	fmt.Println(r.String())
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OBS

type OBS struct {
	*obs.ObsClient
	Bucket string
}

func NewOBS

func NewOBS(accessKey, secretKey, endPoint, bucket string) (*OBS, error)

func (*OBS) CopyDirectory

func (s *OBS) CopyDirectory(src, dst string, filter ...func(relpath string) bool) error

CopyDirectory copy src/* to dst/*

func (*OBS) GetMeta

func (s *OBS) GetMeta(path string) (*obs.GetObjectMetadataOutput, error)

func (*OBS) GetReader

func (s *OBS) GetReader(path string) (io.ReadCloser, error)

GetReader path file reader, close reader after reading

func (*OBS) ListFile

func (s *OBS) ListFile(prefix string, max int) ([]ObsFile, error)

Write buf -> obs path

func (*OBS) NormPath

func (s *OBS) NormPath(path string) string

func (*OBS) Read

func (s *OBS) Read(path string) (*bytes.Buffer, error)

Read path file to buffer

func (*OBS) Write

func (s *OBS) Write(buf io.Reader, path string) error

Write buf -> obs path

type ObsFile

type ObsFile struct {
	Name         string
	IsDir        bool
	Size         int64
	LastModified time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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