Documentation ¶
Overview ¶
Package filestore provide a storage backend based on the local file system.
FileStore is a storage backend used as a tus.DataStore in tus.NewTus. It stores the uploads in a directory specified in two different files: The `[id].info` files are used to store the fileinfo in JSON format. The `[id]` files without an extension contain the raw binary data uploaded. No cleanup is performed so you may want to run a cronjob to ensure your disk is not filled up with old and finished uploads.
Index ¶
- type FileStore
- func (store FileStore) AsConcatableUpload(upload tus.Upload) tus.ConcatableUpload
- func (store FileStore) AsLengthDeclarableUpload(upload tus.Upload) tus.LengthDeclarableUpload
- func (store FileStore) AsTerminatableUpload(upload tus.Upload) tus.TerminatableUpload
- func (store FileStore) GetUpload(ctx context.Context, id string) (tus.Upload, error)
- func (store FileStore) NewUpload(ctx context.Context, info tus.FileInfo) (tus.Upload, error)
- func (store FileStore) UseIn(composer *tus.StoreComposer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct { // Relative or absolute path to store files in. FileStore does not check // whether the path exists, use os.MkdirAll in this case on your own. Path string }
FileStore See the tus.DataStore interface for documentation about the different methods.
func New ¶
New creates a new file based storage backend. The directory specified will be used as the only storage entry. This method does not check whether the path exists, use os.MkdirAll to ensure. In addition, a locking mechanism is provided.
func (FileStore) AsConcatableUpload ¶
func (store FileStore) AsConcatableUpload(upload tus.Upload) tus.ConcatableUpload
func (FileStore) AsLengthDeclarableUpload ¶
func (store FileStore) AsLengthDeclarableUpload(upload tus.Upload) tus.LengthDeclarableUpload
func (FileStore) AsTerminatableUpload ¶
func (store FileStore) AsTerminatableUpload(upload tus.Upload) tus.TerminatableUpload
func (FileStore) UseIn ¶
func (store FileStore) UseIn(composer *tus.StoreComposer)
UseIn sets this store as the core data store in the passed composer and adds all possible extension to it.