Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
example
src
test
.gitignore
.npmignore
.snyk
README.md
package.json
tsconfig.json

README.md

RainCatcher FileStore

Server-side express module to support file uploads from the @raincatcher/filestore-client module.

Usage

In order to include this module in an existing express application, use the createRouter function and supply an implementation of the FileStorage interface.

import { createRouter, FileStorage, GridFsStorage } from '@raincatcher/filestore';

//...

const storage: FileStorage = new GridFsStorage(mongoDbConnectionUrl);
expressApp.use('/file', createRouter(storage));

FileStorage Interface

The FileStorage is an interface that should be implemented in order to supply an alternative place for file data to be transferred to, based on manipulating NodeJS Streams to allow storage and retrieval of the uploaded binary data.

Implementations

The current implementations support:

  • GridFS (MongoDB's API for storing larger files - GridFsStorage)
  • Amazon S3 (S3Storage)
  • Local file storage (LocalStorage)

See individual storage implementations for the list of required parameters.