cworsley4 / express-rest-file-server

CRUD operations with files storing in-memory or disk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-rest-file-server

Build Status Commitizen friendly Version npm npm Downloads

NPM

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 or disk (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

About

CRUD operations with files storing in-memory or disk

License:MIT License


Languages

Language:JavaScript 100.0%