Skip to content

Express / Multer Storage

The @flystorage/multer-storage package provides an storage implementation for multer, which enables file uploads from express to any of the supported storage solutions.


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


import {FileStorage} from '@flystorage/file-storage';
import {FlystorageMulterStorageEngine} from '@flystorage/multer-storage';
import multer from 'multer';
import express from 'express';
const adapter = createYourAdapter();
const fileStorage = new FileStorage(adapter);
const storage = new FlystorageMulterStorageEngine(
async (action, _req: express.Request, file: Express.Multer.File) => {
if (action === 'handle') {
return file.originalname;
} else {
return file.destination;
const uploader = multer({storage});
const app = express();'/upload/document', uploader.single('document'), , (req, res, next) => {
// req.file is the `document` file
// req.body will hold the text fields, if there were any

Express examples

For more Express examples, read the multer docs.