express-rest-file-server
v1.1.0
Published
CRUD operations with files storing in-memory or disk
Downloads
4
Maintainers
Readme
express-rest-file-server
An express based application, inspired by mock-file-server, to be used as a CRUD file server storing content in the memory (temporal) or in the disk (permanent) of the server.
Usage
You can either install it globally o locally to your project
# global installation
npm install -g express-rest-file-server
# local installation
npm install express-rest-file-server
To start using it with default options, just run
# global installation
express-rest-file-server
# local installation
npx express-rest-file-server
Options
- port: defaults to 5000
- storageType: can be
memory
ordisk
(defaults to memory) - storagePath: where to store the files if storage is set to
disk
(defaults to/tmp
)
Routes
POST /files
Uploads a file to the store with its original name
POST /files/:filename
Uploads a file to the store with a custom name (:filename)
POST /files/chunk/:filename
Uploads a chuck of a file to the store with a custom name (:filename)
POST /files/assemble/:filename
Builds a file from its chunks
GET /files/:filename
Retrieve a file by its name
GET /files/:filename/size
Retrieve a file size by its name
DELETE /files/:filename
Remove a file by its name