Light Storage Service
LSS is a simple web storage API.
Requirements
Installation
$ go get github.com/Masterminds/glide
$ glide install
Usage
API Reference
POST /my_directory/file.txt
Attributes:
name |
value |
file |
binary file |
List files
GET /my_directory?list
{
"/my_directory": {
"directory": true,
"size": 102,
"updated_at": "2017-01-16T09:55:36+01:00"
},
"/my_directory/file.txt": {
"directory": false,
"size": 764,
"updated_at": "2017-01-16T09:55:36+01:00"
},
"/my_directory/depth/file.txt": {
"directory": false,
"size": 764,
"updated_at": "2017-01-16T09:55:36+01:00"
}
}
GET /my_directory?list&depth=1
{
"/my_directory": {
"directory": true,
"size": 102,
"updated_at": "2017-01-16T09:55:36+01:00"
},
"/my_directory/file.txt": {
"directory": false,
"size": 764,
"updated_at": "2017-01-16T09:55:36+01:00"
}
}
Check if a file or directory exists
HEAD /my_directory/file.txt
200 OK
or 404 Not Found
GET /my_directory/file.txt?metadata
{
"directory": false,
"size": 585,
"updated_at": "2017-01-16T10:08:06+01:00"
}
Download a file
GET /my_directory/file.txt
Lorem ipsum dolor sit amet
Configuration
Environment variables:
LSS_WORKSPACE
(default: ./workspace
)
LSS_UPLOAD_SIZE_LIMIT
(default: 8G
)
LSS_ROUTER_NAMESPACE
(default: ""
; e.g. /lss
)
Development
$ go run lss.go -h
$ go run lss.go server -b localhost -p 5000
# Or with live-reload
$ make live-reload # needs fswatch tool
# Before pushing to Github
$ find . -name '*.go' -not -path './vendor*' -exec go fmt {} \;
Production
$ go build -o lss lss.go
$ ./lss -p 4005 -w /data
$ docker run -p 8888:8080 -v /my_data:/data -d mdouchement/lss
License
MIT
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request