cs3

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 15 Imported by: 1

README

gFly Contabo S3 Storage

Usage

Install

# Storage
go get -u github.com/gflydev/storage@v1.1.0

# S3 Storage
go get -u github.com/gflydev/storage/cs3@v1.1.0

Quick usage main.go

import (
    "github.com/gflydev/core"
    "github.com/gflydev/storage"
    storageCS3 "github.com/gflydev/storage/cs3"	
)

func main() {
    // Register CS3 storage
    storage.Register(storageS3.Type, storageCS3.New())

    // Create S3 storage with default
    fs := storage.Instance(storageS3.Type)

	// Create folder `foo/bar` and add file `hello.txt`
    if ok := fs.MakeDir("foo/bar"); ok {
        fs.Put("foo/bar/hello.txt", "Hello world")
    }
}
CS3 setting

Make sure CS3 below setting:

Documentation

Index

Constants

View Source
const (
	Type = storage.Type("cs3")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	S3Client *minio.Client
}

func New

func New() *Storage

New Create S3 Storage with basics info.

func (*Storage) Append

func (s *Storage) Append(path, data string) bool

func (*Storage) Copy

func (s *Storage) Copy(from, to string) bool

func (*Storage) Delete

func (s *Storage) Delete(path string) bool

func (*Storage) DeleteDir

func (s *Storage) DeleteDir(dir string) bool

func (*Storage) Exists

func (s *Storage) Exists(path string) bool

func (*Storage) Get

func (s *Storage) Get(path string) ([]byte, error)

func (*Storage) GetStream added in v1.2.2

func (s *Storage) GetStream(path string) (io.ReadCloser, error)

GetStream returns a stream (io.ReadCloser) for the object at the given path This allows for efficient streaming without loading the entire file into memory

func (*Storage) LastModified

func (s *Storage) LastModified(path string) time.Time

func (*Storage) MakeDir

func (s *Storage) MakeDir(dir string) bool

func (*Storage) Move

func (s *Storage) Move(from, to string) bool

func (*Storage) Put

func (s *Storage) Put(path, contents string) bool

func (*Storage) PutData

func (s *Storage) PutData(path string, contents []byte) bool

PutData Create file by content

func (*Storage) PutFile

func (s *Storage) PutFile(path string, fileSource *os.File) bool

func (*Storage) PutFilepath

func (s *Storage) PutFilepath(path, filePath string, options ...interface{}) bool

func (*Storage) Size

func (s *Storage) Size(path string) int64

func (*Storage) Url

func (s *Storage) Url(path string) string

Url Get public URL of an object via path Pattern URL `https://<region>.contabostorage.com/<bucket_code>:<bucket>/<key>`

Jump to

Keyboard shortcuts

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