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

Getting Started


 go get


Storage Creation

// Creates new Storer backed by a file system
var storage docstore.Storer = docstore.NewFileStore("/Volumes/storage")

Storing a document

// 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)

Retrieving a document

getObj, _ := storage.Get(fileName)

newFile := os.Create("newFile.jpg")
defer newFile.Close()
defer getObj.Close()
numBytes, err := io.Copy(newFile, getObj)


  • Pull requests welcome
  • Feel free to add new docstore.Storer Implementations


Released under the MIT License

Software Engineer

My interests include software architecture and team building. The views and opinions expressed in this article are those of the me and do not necessarily reflect the official policy or position of my employer past or present.