{"id":48618,"library":"multer-s3-svgsanitycheck","title":"Multer S3","description":"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.","status":"active","version":"3.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/GleapSDK/multer-s3","tags":["javascript","multer","s3","amazon","aws"],"install":[{"cmd":"npm install multer-s3-svgsanitycheck","lang":"bash","label":"npm"},{"cmd":"yarn add multer-s3-svgsanitycheck","lang":"bash","label":"yarn"},{"cmd":"pnpm add multer-s3-svgsanitycheck","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: provides S3Client for v3.x of multer-s3","package":"@aws-sdk/client-s3","optional":false}],"imports":[{"note":"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'`.","wrong":"import multerS3 from 'multer-s3';","symbol":"default (multerS3)","correct":"const multerS3 = require('multer-s3');"},{"note":"v3 uses the modular @aws-sdk/client-s3 package, not the monolithic aws-sdk v2.","wrong":"const AWS = require('aws-sdk'); const s3 = new AWS.S3();","symbol":"S3Client","correct":"const { S3Client } = require('@aws-sdk/client-s3');"},{"note":"Multer is still CommonJS-only.","wrong":"import multer from 'multer';","symbol":"multer","correct":"const multer = require('multer');"}],"quickstart":{"code":"const { S3Client } = require('@aws-sdk/client-s3');\nconst express = require('express');\nconst multer = require('multer');\nconst multerS3 = require('multer-s3');\n\nconst app = express();\nconst s3 = new S3Client({ region: 'us-east-1', credentials: { accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '', secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '' } });\n\nconst upload = multer({\n  storage: multerS3({\n    s3: s3,\n    bucket: 'my-bucket',\n    acl: 'public-read',\n    key: function (req, file, cb) {\n      cb(null, Date.now().toString() + '-' + file.originalname);\n    }\n  })\n});\n\napp.post('/upload', upload.single('file'), function(req, res) {\n  res.json({ location: req.file.location });\n});\n\napp.listen(3000);","lang":"javascript","description":"Sets up an Express server with multer-s3 storage engine for uploading a single file to S3 and returning the file location."},"warnings":[{"fix":"Replace 'aws-sdk' with '@aws-sdk/client-s3' and update constructor: new S3Client() instead of new AWS.S3().","message":"Version 3.x drops AWS SDK v2 support; use @aws-sdk/client-s3 and @aws-sdk/lib-storage.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade to 3.x and migrate to AWS SDK v3.","message":"Version 2.x is deprecated and no longer maintained.","severity":"deprecated","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Install @aws-sdk/client-s3 (v3) which includes @aws-sdk/lib-storage as a dependency. No extra install needed.","message":"s3.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?).","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"const s3 = new S3Client(); then pass s3 to multerS3({ s3 }).","message":"The 's3' option must be an instance of S3Client, not a raw client from v2.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use synchronous logic or promisify the callback pattern.","message":"File key function receives 'req', 'file', and 'cb'. Using async/await inside the callback is not supported; use callbacks.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'/client-s3':58 '/lib-storage':21 '12':51 '3.0.0':59 '3.0.5':11 'amazon':66 'applic':48 'aw':8,13,19,27,56,67 'aws-sdk':18,55 'buffer':38 'class':23 'depend':54 'direct':34 'disk':40 'engin':6 'gleapsdk':62 'high':46 'high-traff':45 'javascript':63 'maintain':60 'make':41 'multer':1,4,64 'multipart':32 'node':50 'peer':53 'requir':49 's3':2,9,36,65 'scalabl':43 'sdk':14,20,28,57 'storag':5 'stream':3,31 'traffic':47 'upload':22,33 'use':12,26 'v2':29 'v2.x':25 'v3':15 'version':10 'without':37","created_at":"2026-06-07T16:57:33.747020+00:00","updated_at":"2026-06-07T16:57:33.747020+00:00","problems":[{"fix":"npm install @aws-sdk/client-s3","cause":"Missing peer dependency","error":"Cannot find module '@aws-sdk/client-s3'"},{"fix":"Use require('multer-s3') instead of import multerS3 from 'multer-s3'","cause":"Attempting ESM import with default export on a CJS module","error":"TypeError: multerS3 is not a function"},{"fix":"Use multer-s3 v3 which handles uploading via Upload class internally. No direct s3.upload call needed.","cause":"Using AWS SDK v2 style upload on v3 S3Client","error":"TypeError: s3.upload is not a function"},{"fix":"Create an S3Client from @aws-sdk/client-s3 and pass that.","cause":"Passing an AWS SDK v2 S3 instance to multerS3 in v3","error":"The provided value 's3' is not a valid S3Client"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/GleapSDK/multer-s3#readme","github":"https://github.com/GleapSDK/multer-s3","docs":null,"changelog":null,"pypi":null,"npm":"multer-s3-svgsanitycheck","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}