Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docstore

Document(file) Storage abstraction for golang

Overview

  • Single Basic Interface for storing and retrieving documents
  • Store and retrieve documents based on keys
  • Implementations
  • Amazon S3
  • File system

Getting Started

Installing:

 go get github.com/docstore/storage

Example

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)

Contributing

https://github.com/docstore/storage/graphs/contributors

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

License

Released under the MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages