files

package
v0.0.0-...-bea733e Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT 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 filesytem with the given base path basePath is the base directory to save files to 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 behavior 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