1.0.1 • Published 4 years ago

@jacobbubu/rest-file-server v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@jacobbubu/rest-file-server

Build Status Coverage Status npm

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-server

Start server:

npm start

Upload and Download

curl -X POST -F "file=@README.md" http://localhost:8080/files

THEN get it back,

curl http://localhost:8080/files/README.md

Enable JWT token

Start server:

npm start -- --useToken=true

Get Token

curl http://localhost:8080/token?expiresIn=100

expiresIn 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.