linstrom/storage/mediaProvider/mediaProvider.go

24 lines
674 B
Go

package mediaprovider
import "io"
// TODO: Implement me
type FileProvider interface {
// Return the filepath (including name) to every file in the given folder
ListFiles(folder string) (filePaths []string)
// Check whether a given filepath exists
HasFile(filePath string) (ok bool)
// Read the content of a file
ReadFile(filePath string) (data io.Reader, err error)
// Write the given data to a file.
// If it exists, overwrite it
// It it doesn't exist, create it
WriteFile(filePath string, data io.Reader) (err error)
// Delete a given file. If it doesn't exist, do nothing
DeleteFile(filePath string)
}
type MediaStorage struct {
provider FileProvider
}