Package tempstorage

Overview ▾

func Add

func Add(path string) error

Add reads a file from a disk and adds it to the storage.

func RemoveAll

func RemoveAll(dir string) error

RemoveAll removes all files according to the dir argument prefix.

func SetAsStorage

func SetAsStorage(newStorage storage)

SetAsStorage changes temporary storage to newStorage.

func TempDir

func TempDir(pattern string) (string, error)

TempDir creates a name for a new temp directory using a pattern argument.

type File

File is a representation of a storage file with Read, Write, Close and Name methods identical to os.File.

type File interface {
    Name() string

func Open

func Open(path string) (File, error)

Open returns tempstorage File object by name.

func TempFile

func TempFile(dir, pattern string) (File, error)

TempFile creates new empty file in the storage and returns it.


Name Synopsis
diskstore Package diskstore implements tempStorage interface by using disk as a storage
memstore Package memstore implements tempStorage interface by using memory as a storage