Document(file) Storage abstraction for golang
- Single Basic Interface for storing and retrieving documents
- Store and retrieve documents based on keys
- Implementations
- Amazon S3
- File system
Installing:
go get github.com/docstore/storage
// Creates new Storer backed by a file system
var storage docstore.Storer = docstore.NewFileStore("/Volumes/storage")
// Prepares putObj with ioreader and Identifier
file, _ := os.Open(fileName)
putObj := docstore.CreateObj{
Identifier: fileName,
ReadSeeker: file,
}
//store the photo
//errors ignored
id, err := storage.Put(putObj)
getObj, _ := storage.Get(fileName)
newFile := os.Create("newFile.jpg")
defer newFile.Close()
defer getObj.Close()
numBytes, err := io.Copy(newFile, getObj)
https://github.com/docstore/storage/graphs/contributors
- Pull requests welcome
- Feel free to add new docstore.Storer Implementations
Released under the MIT License