@flystorage/multer-storage
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Flystorage for multer

This package contains the Flystorage bindings for multer.

This allows multer to upload to any of the supported Flystorage filesystems.

Installation

Install all the required packages

npm install --save @flystorage/file-storage @flystorage/multer-storage

Usage

import {FileStorage} from '@flystorage/file-storage';
import {FlystorageMulterStorageEngine} from '@flystorage/multer-storage';
import multer from 'multer';

const adapter = createYourAdapter();
const fileStorage = new FileStorage(adapter);

const storage = new FlystorageMulterStorageEngine(
    uploadStorage,
    async (action, _req: express.Request, file: Express.Multer.File) => {
        if (action === 'handle') {
            return file.originalname;
        } else {
            return file.destination;
        }
    }
);

const uploader = multer({storage});

Package Sidebar

Install

npm i @flystorage/multer-storage

Weekly Downloads

4

Version

0.1.0

License

MIT

Unpacked Size

5.3 kB

Total Files

6

Last publish

Collaborators

  • frankdejonge