tinynfs A small file & image storage system
The tinynfs use the HTTP REST API for mostly usage.
Success reponse like:
{
"code": 0,
"data": {
... more fields ...
}
}Error response like:
{
"code": 105,
"error": "unsupported media type"
}It set the HTTP Status Code when Error Response.
curl -X POST \
http://127.0.0.1:7119/upload \
-F filepath=/files/jmeter.log \
-F filedata=@/Users/vietor/jmeter.logUse PUT to overwrite exists file.
{
"code": 0,
"data": {
"size": 118717,
"mime": "text/plain",
"filepath": "/files/jmeter.log"
}
}The file path was reponsed by /upload
http://127.0.0.1:7119/get?filepath=/files/jmeter.log
The file path was reponsed by /upload
curl -X POST \
http://127.0.0.1:7119/delete \
-F filepath=/files/jmeter.log \{
"code": 0,
"data": {
"filepath": "/files/jmeter.log"
}
}Supported type: gif, jpeg, png.
Image can operation in File Storage, like Delete.
curl -X POST \
http://127.0.0.1:7120/upload \
-F imagedata=@/Users/vietor/Pictures/demo.jpg{
"code": 0,
"data": {
"size": 60133,
"width": 312,
"height": 304,
"image_url": "/image1/c2320d8876dfcbbf715f5b8f40e3"
}
}curl -X POST \
http://127.0.0.1:7120/uploads \
-F imagedata1=@/Users/vietor/Pictures/demo1.jpg \
-F imagedata2=@/Users/vietor/Pictures/demo2.jpg \
-F imagedata3=@/Users/vietor/jmeter.log{
"code": 0,
"data": {
"imagedata1": {
"size": 409375,
"width": 972,
"height": 1386,
"image_url": "/image1/f9efdbbffa65ba17f1a45b8ea9a8"
},
"imagedata2": {
"size": 43735,
"width": 435,
"height": 487,
"image_url": "/image1/4bf143e55eae3d3d51955b8ea9a8"
},
"imagedata3": {
"error": "unsupported media type"
}
}
}The image url was reponsed by /upload or /uploads
http://127.0.0.1:7120/image1/c2320d8876dfcbbf715f5b8f40e3
The origin image url add the "_" and thumbnail size stuffix
the gif transform to png
http://127.0.0.1:7120/image1/c2320d8876dfcbbf715f5b8f40e3_192x192
The acceptable thumbnail size was defined in configuration file
# network.image.thumbnail.sizes=240x240,192x192
- The
tinynfsuse sha256 to save storage of the same file. - The
tinynfsnever recovery volume disk space. When deleting a file, it simply discards the file path and does not make any modifications to the volume file.