Registry / storage / multer-s3-svgsanitycheck

multer-s3-svgsanitycheck

JSON →
library3.0.5jsnpmunverified

Streaming multer storage engine for AWS S3. Version 3.0.5 uses AWS SDK v3 with the @aws-sdk/lib-storage Upload class, while v2.x uses AWS SDK v2. It streams multipart uploads directly to S3 without buffering to disk, making it scalable for high-traffic applications. Requires Node >= 12 and peer dependency @aws-sdk/client-s3 ^3.0.0. Maintained by GleapSDK.

npm install multer-s3-svgsanitycheck
INSTALL
IMPORT
SIG · MULTER-S3-SVGSANIT
M
multer-s3-svgsanitycheck
storagejavascriptv3.0.5
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.

default (multerS3)
const multerS3 = require('multer-s3');
import multerS3 from 'multer-s3';
Package does not ship ESM; use CommonJS require. TypeScript users may need to import with `import multerS3 = require('multer-s3')` or use `import * as multerS3 from 'multer-s3'`.
S3Client
const { S3Client } = require('@aws-sdk/client-s3');
const AWS = require('aws-sdk'); const s3 = new AWS.S3();
v3 uses the modular @aws-sdk/client-s3 package, not the monolithic aws-sdk v2.
multer
const multer = require('multer');
import multer from 'multer';
Multer is still CommonJS-only.

Sets up an Express server with multer-s3 storage engine for uploading a single file to S3 and returning the file location.

const { S3Client } = require('@aws-sdk/client-s3'); const express = require('express'); const multer = require('multer'); const multerS3 = require('multer-s3'); const app = express(); const s3 = new S3Client({ region: 'us-east-1', credentials: { accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '', secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '' } }); const upload = multer({ storage: multerS3({ s3: s3, bucket: 'my-bucket', acl: 'public-read', key: function (req, file, cb) { cb(null, Date.now().toString() + '-' + file.originalname); } }) }); app.post('/upload', upload.single('file'), function(req, res) { res.json({ location: req.file.location }); }); app.listen(3000);
Debug
Known issues
breakingVersion 3.x drops AWS SDK v2 support; use @aws-sdk/client-s3 and @aws-sdk/lib-storage.
fix
Replace 'aws-sdk' with '@aws-sdk/client-s3' and update constructor: new S3Client() instead of new AWS.S3().
affects: >=3.0.0
deprecatedVersion 2.x is deprecated and no longer maintained.
fix
Upgrade to 3.x and migrate to AWS SDK v3.
affects: >=2.0.0 <3.0.0
gotchas3.upload (v2) vs Upload class (v3): v3 uses Upload from @aws-sdk/lib-storage internally; ensure @aws-sdk/lib-storage is installed (included with @aws-sdk/client-s3?).
fix
Install @aws-sdk/client-s3 (v3) which includes @aws-sdk/lib-storage as a dependency. No extra install needed.
affects: >=3.0.0
gotchaThe 's3' option must be an instance of S3Client, not a raw client from v2.
fix
const s3 = new S3Client(); then pass s3 to multerS3({ s3 }).
affects: >=3.0.0
gotchaFile key function receives 'req', 'file', and 'cb'. Using async/await inside the callback is not supported; use callbacks.
fix
Use synchronous logic or promisify the callback pattern.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module '@aws-sdk/client-s3'
Missing peer dependency
fix
npm install @aws-sdk/client-s3
TypeError: multerS3 is not a function
Attempting ESM import with default export on a CJS module
fix
Use require('multer-s3') instead of import multerS3 from 'multer-s3'
TypeError: s3.upload is not a function
Using AWS SDK v2 style upload on v3 S3Client
fix
Use multer-s3 v3 which handles uploading via Upload class internally. No direct s3.upload call needed.
The provided value 's3' is not a valid S3Client
Passing an AWS SDK v2 S3 instance to multerS3 in v3
fix
Create an S3Client from @aws-sdk/client-s3 and pass that.
Upgrade
Version history
3.0.5latest on npm
Audit
Dependencies
@aws-sdk/client-s3requiredPeer dependency: provides S3Client for v3.x of multer-s3
Agent activity
26 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
multer-s3-svgsanitycheck — npm install multer-s3-svgsanitycheck · libregistry