0.0.11 • Published 8 years ago

minicloud-storage v0.0.11

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

build status Test coverage devDependency Status

lightweight distributed file storage module.

It is a minicloud file storage module.it can be deployed separately.

Installation

$ npm install minicloud-storage co

Create file index.js

require('co').wrap(function*(){
	var app = yield require('minicloud-storage')()
	app.listen(8031)
})()

Run Server

$ node index.js 

Test case

//get current storage node disk space
//time is current timestamp,can not exceed 24 hours diff with current time.
//signature=md5(session_id+time+safe_code)
curl -X POST http://127.0.0.1:8031/api/v1/status/info \
    --header "Content-Type: application/json" \
    --data "{\"session_id\":\"xxxxx\",\"signature\":\"xxxx\",\"time\":1278927966}" 

//If successful, there will be the following information output
[
  {
    path: '/dev/mapper/VolGroup-lv_home',
    used: 11636604,(unit:kb)
    total: 2060025240(unit:kb) 
	}
]

minicloud-storage is supported in all versions of iojs without any flags.To use minicloud-storage with node, you must be running node 0.12.0 or higher for generator and promise support, and must run node(1) with the --harmony-generators or --harmony flag.

API

minicloud-storage api has provided 6 API.

  • support hard disk usage statistics

  • support large file block upload/simple file upload

  • support file content download

  • support return thumbnail for an image.include ai,bmp,eps,gif,jpg,jpeg,png,psd,tif,tiff

  • support socket.io,http api can seamless convert to websocket.demo>>

License

MIT