files

package
v0.0.0-...-9ba6240 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Local

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

Local is an implementation of the Storage interface which works with the local disk on the current machine

func NewLocal

func NewLocal(basePath string, maxSize int) (*Local, error)

NewLocal creates a new local filesystem with the given base path basePath is the base directory to save files maxSize is the max number of bytes that a file can be

func (*Local) Get

func (l *Local) Get(path string) (*os.File, error)

Get the file at the given path and return a Reader the calling function is responsible for closing the reader

func (*Local) Save

func (l *Local) Save(path string, contents io.Reader) error

Save the contents of the Writer to the given path path is a relative path, basePath will be appended

type Storage

type Storage interface {
	Save(path string, file io.Reader) error
}

Storage defines the behaviour for file operations Implementations may be of the time local disk, or cloud storage, etc

Jump to

Keyboard shortcuts

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