1.0.1 • Published 5 years ago
@jacobbubu/rest-file-server v1.0.1
@jacobbubu/rest-file-server
A test file upload server.
Intro.
This tool was modified from express-rest-file-server, but I made the following revisions:
- Only support memory storage.
- File uploads can be speed limited.
Usage
npm install @jacobbubu/rest-file-serverStart server:
npm startUpload and Download
curl -X POST -F "file=@README.md" http://localhost:8080/filesTHEN get it back,
curl http://localhost:8080/files/README.mdEnable JWT token
Start server:
npm start -- --useToken=trueGet Token
curl http://localhost:8080/token?expiresIn=100expiresIn indicates the number of seconds after which the token timed out, which can be a negative value. The default value is one day.
Upload
curl -X POST -F "file=@README.md" http://localhost:8080/files -H "Authorization: Bearer eyJhbGciOiJI..."Please see test cases for more usage.