https://github.com/mdouchement/lss
Light Storage Service, a simple lightweight web storage API.
https://github.com/mdouchement/lss
data-storage golang storage-engine
Last synced: 16 days ago
JSON representation
Light Storage Service, a simple lightweight web storage API.
- Host: GitHub
- URL: https://github.com/mdouchement/lss
- Owner: mdouchement
- License: mit
- Created: 2017-01-16T09:18:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-22T09:32:29.000Z (over 9 years ago)
- Last Synced: 2025-02-24T17:15:38.875Z (over 1 year ago)
- Topics: data-storage, golang, storage-engine
- Language: Go
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Light Storage Service
[](https://godoc.org/github.com/mdouchement/lss)
[](https://goreportcard.com/report/github.com/mdouchement/lss)
[](http://opensource.org/licenses/MIT)
[](https://hub.docker.com/r/mdouchement/lss/)
LSS is a simple web storage API.
## Requirements
- Golang 1.7.x
## Installation
```bash
$ go get github.com/Masterminds/glide
$ glide install
```
## Usage
### API Reference
#### Upload a file (`multipart/form-data`)
```
POST /my_directory/file.txt
```
Attributes:
name | value
:--- | :---
file | binary file
#### List files
```
GET /my_directory?list
```
```json
{
"/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
```
```json
{
"/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`
#### Metadata of a file or a directory
```
GET /my_directory/file.txt?metadata
```
```json
{
"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
```bash
$ 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
```bash
$ go build -o lss lss.go
$ ./lss -p 4005 -w /data
```
- Docker
```bash
$ docker run -p 8888:8080 -v /my_data:/data -d mdouchement/lss
```
## License
**MIT**
## Contributing
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
5. Push to the branch (git push origin my-new-feature)
6. Create new Pull Request