Registry / storage / multer-minio-storage

multer-minio-storage

JSON →
library1.0.0jsnpmunverified

A Multer storage engine for uploading files directly to MinIO object storage. Current stable version 1.0.0 targets Node >=10 and requires MinIO JavaScript client ^7.0.16. It provides a simple, configurable file filter and custom metadata support, integrating Multer's middleware pattern with MinIO's S3-compatible API. Key differentiator: minimal configuration compared to using multer-s3 for non-AWS S3-compatible services.

npm install multer-minio-storage
INSTALL
IMPORT
SIG · MULTER-MINIO-STORA
M
multer-minio-storage
storagejavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createMinioStorage
import { createMinioStorage } from 'multer-minio-storage';
const createMinioStorage = require('multer-minio-storage');
ESM-first with TypeScript types; CommonJS require is not supported because package uses ES modules.
MinioStorageOptions
import type { MinioStorageOptions } from 'multer-minio-storage';
import { MinioStorageOptions } from 'multer-minio-storage';
Use type import for TypeScript to avoid runtime errors; the interface is only a type.
default (the storage engine factory)
import multerMinio from 'multer-minio-storage';
import { default } from 'multer-minio-storage';
The package has a default export that directly provides the multer storage engine factory. Named import of 'default' is invalid.

Configures multer to store uploaded files on MinIO using multer-minio-storage with custom metadata and filename functions.

import multer from 'multer'; import { createMinioStorage } from 'multer-minio-storage'; import * as Minio from 'minio'; const minioClient = new Minio.Client({ endPoint: 'play.min.io', port: 9000, useSSL: true, accessKey: process.env.MINIO_ACCESS_KEY || '', secretKey: process.env.MINIO_SECRET_KEY || '', }); const storage = createMinioStorage({ minioClient, bucket: 'uploads', metadata: (req, file, cb) => { cb(null, { fieldName: file.fieldname }); }, filename: (req, file, cb) => { cb(null, `${Date.now()}-${file.originalname}`); }, }); const upload = multer({ storage }); export default upload;
Debug
Known issues
breakingPackage uses ES modules (type: 'module' in package.json). CommonJS require() will throw.
fix
Use import syntax or set project to ES modules. If you must use CommonJS, use dynamic import() with .default.
affects: >=1.0.0
gotchaminioClient must be a pre-configured Minio.Client instance. Passing a client without required connection parameters will cause silent failures or timeouts.
fix
Always verify minioClient is correctly initialized with endPoint, accessKey, secretKey, and optionally port and useSSL.
affects: >=1.0.0
deprecatedNo known deprecation warnings yet for version 1.0.0. However, the dependency minio ^7.0.16 may introduce breaking changes in future minio versions.
fix
Pin minio to ^7.0.16 in package.json to avoid unexpected updates.
affects: >=1.0.0
gotchaBucket must already exist in MinIO. The package does not automatically create the bucket.
fix
Ensure the bucket is created before uploading files, e.g., using MinIO client: minioClient.bucketExists('bucketName').then(...).
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'Client')
minio package not installed or incorrectly imported. The package expects the minio peer dependency.
fix
Install minio: npm install minio@^7.0.16. Then import as: import * as Minio from 'minio';
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using CommonJS require() to import an ESM-only package.
fix
Switch to ES module syntax: import { createMinioStorage } from 'multer-minio-storage'; or use dynamic import: const { createMinioStorage } = await import('multer-minio-storage');
Error: Bucket not found: undefined
Storage option 'bucket' is missing or undefined in the options object.
fix
Provide a bucket name in the storage options, e.g., { bucket: 'my-bucket' }.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
miniorequiredRequired peer dependency for interacting with MinIO server
Agent activity
29 hits · last 30 days
node
26
Amazon
1
Resources
multer-minio-storage — npm install multer-minio-storage · libregistry