express-file-store
express middleware to access/write/remove files (using file path) with various backends.
Usage (middleware)
$ npm install express-file-store --save
var express = ;var FileStore = ; // using file systemvar fileStore = ; // or using gridfsvar fileStore = ; // or using s3var fileStore = ; // in expressvar app = ; // POST /a/b/c.png to upload// GET /a/b/c.png to download// DELETE /a/b/c.png to removeapp; // or directly fileStore; fileStore; fileStore; // ...
Usage (standalone)
$ npm install -g express-file-store
$ efs gridfs -p 8080 -u mongodb://localhost:27017/test # start a server with gridfs backend
$ efs fs -p 8080 -p $(pwd) # start a server with fs backend
$ efs fs # will start file server on port 8080 in current pwd
$ efs s3 -p 8080 -k $AMAZON_ACCESS_KEY_ID -s $AMAZON_ACCESS_KEY_SECRET -b $S3_BUCKET -r $S3_REGION # start a server with S3 backend
$ curl -F file=@README.md http://localhost:8080/README.md
$ curl --data-binary @package.json -H "Content-Type: application/json" http://localhost:8080/package.json
Development
$ git clone git@github.com:seedalpha/express-file-store.git
$ cd express-file-store
$ npm install
$ npm test # make sure you have mongodb and s3 credentials in place
Author
Vladimir Popov rusintez@gmail.com
License
MIT