Coder Social home page Coder Social logo

foundationfs's Introduction

FoundationFS

FoundationFS is a File Storage system for FoundationDB written in go intended to mimic mongodb gridfs file storage layer.

Includes an example http server interface with support for basic upload and download of any file type.

Installation

go get github.com/cloudmode/FoundationFS

Dependencies

FoundationFS requires:

Go 1.1+ with CGO enabled FoundationDB C API 2.0.x or 3.0.x (part of the FoundationDB clients package) Use of this package requires the selection of a FoundationDB API version at runtime. This package currently supports FoundationDB API versions 200 and 300 (although version 300 requires a 3.0.x FoundationDB C library to be installed).

To install the fdb-go package interface (https://github.com/FoundationDB/fdb-go):

go get github.com/FoundationDB/fdb-go/fdb

FoundationFS uses go/codec (using the msgpack codec) for storing values in FDB such as the file meta data. (https://github.com/ugorji/go)

To install the go/codec package:

go get github.com/ugorji/go/codec

Other dependencies:

go get github.com/twinj/uuid

Example

To run the example:

cd examples
go run simple.go

The server will be listening on localhost:9090. Direct your browser to localhost:9090/upload, upload a file and json with the id of the uploaded file returned. Copy and paste the id of the uploaded file into http://localhost:9090/download?id= and the file will be displayed in your browser

To test with curl:

curl -i -X POST -H "Content-Type: multipart/form-data" -F "[email protected]" http://localhost:9090/upload
curl -o foo.png http://localhost:9090/download?id=<the id returned from previous curl POST>

Test Suite

The test suite uses the standard go test runner along with convey, download here.

go get github.com/smartystreets/goconvey/convey
cd test
go test

The test script expects there to be at least one file in the test/data subdirectory which is used for uploading and downloading tests. It will fail if there are no files in data.

License

The MIT License (MIT) - see LICENSE.md for more details

foundationfs's People

Contributors

cloudmode avatar

Watchers

James Cloos avatar goroutine avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.