{"id":48625,"library":"multer-storage","title":"multer-storage","description":"A storage engine for Multer (Express middleware) that uploads files directly to Google Cloud Storage. Version 0.4.1 is the latest stable release. The package wraps the @google-cloud/storage client and provides configurable file path, metadata, and ACL settings. It is inspired by multer-s3 but focused on GCS. Uses callbacks for filepath and metadata generation. Currently in early development (WIP) with limited documentation and breaking changes likely in future versions. Release cadence is irregular.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install multer-storage","lang":"bash","label":"npm"},{"cmd":"yarn add multer-storage","lang":"bash","label":"yarn"},{"cmd":"pnpm add multer-storage","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for interacting with Google Cloud Storage API.","package":"@google-cloud/storage","optional":false},{"reason":"Peer dependency; this package provides a storage engine for Multer.","package":"multer","optional":false}],"imports":[{"note":"Package uses CommonJS; ESM import may not work. Default export is the factory function.","wrong":"import MulterGCS from 'multer-storage'","symbol":"default","correct":"const MulterGCS = require('multer-storage')"},{"note":"Named destructuring fails because the module exports a single function directly, not an object.","wrong":"const { MulterGCS } = require('multer-storage')","symbol":"default","correct":"import MulterGCS from 'multer-storage' (if using ESM with bundler)"},{"note":"The default export is a function, so it can be called immediately, but for clarity define a variable.","wrong":"require('multer-storage')({...}) // Works but misleads on export","symbol":"default","correct":"const multer = require('multer'); const MulterGCS = require('multer-storage')"}],"quickstart":{"code":"const express = require('express');\nconst multer = require('multer');\nconst MulterGCS = require('multer-storage');\n\nconst app = express();\n\nconst upload = multer({\n  storage: MulterGCS({\n    projectId: process.env.GCLOUD_PROJECT_ID ?? '',\n    keyFilename: process.env.GCLOUD_KEYFILE ?? '',\n    bucket: process.env.GCLOUD_BUCKET ?? 'my-bucket',\n    metadata: (req, file, cb) => cb(null, { contentType: file.mimetype }),\n    filepath: (req, file, cb) => cb(null, Date.now() + '-' + file.originalname),\n    acl: 'publicRead'\n  })\n});\n\napp.post('/upload', upload.single('file'), (req, res) => {\n  res.send(`Uploaded to: ${req.file.path}`);\n});\n\napp.listen(3000);","lang":"javascript","description":"Sets up an Express server that accepts file uploads and stores them in Google Cloud Storage using multer-storage."},"warnings":[{"fix":"Pin to a specific version and monitor updates.","message":"The package is a work-in-progress (WIP); API may change without notice.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consult the source code or README for correct ACL format.","message":"ACL parameter 'public-read' (kebab-case) in previous examples should be camelCase 'publicRead' in newer versions? Check documentation.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Use 'keyFile' instead.","message":"Using 'keyFilename' is deprecated in favor of 'keyFile' in newer @google-cloud/storage.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Return a relative path like 'uploads/file.pdf'.","message":"The 'filepath' callback must return a path relative to the bucket root, not an absolute path.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'/storage':33 '0.4.1':20 'acl':42 'break':71 'cadenc':78 'callback':56 'chang':72 'client':34 'cloud':17,32 'configur':37 'current':62 'develop':65 'direct':14 'document':69 'earli':64 'engin':6 'express':9 'file':13,38 'filepath':58 'focus':52 'futur':75 'gcs':54 'generat':61 'googl':16,31 'google-cloud':30 'inspir':46 'irregular':80 'javascript':81 'latest':23 'like':73 'limit':68 'metadata':40,60 'middlewar':10 'multer':2,8,49 'multer-s3':48 'multer-storag':1 'packag':27 'path':39 'provid':36 'releas':25,77 's3':50 'set':43 'stabl':24 'storag':3,5,18 'upload':12 'use':55 'version':19,76 'wip':66 'wrap':28","created_at":"2026-06-07T16:57:35.749763+00:00","updated_at":"2026-06-07T16:57:35.749763+00:00","problems":[{"fix":"Ensure you pass a 'bucket' string in the configuration object.","cause":"Missing or undefined 'bucket' option when calling MulterGCS().","error":"Error: The bucket property must be provided"},{"fix":"Use default import: const MulterGCS = require('multer-storage').","cause":"Trying to use a named import (e.g., import { MulterGCS } from 'multer-storage') when the module exports a function as default.","error":"TypeError: MulterGCS is not a function"},{"fix":"Provide an absolute path to a valid service account key JSON file.","cause":"The 'keyFilename' path provided does not exist or is incorrect.","error":"Error: No such file or directory, open '/path/to/keyfile.json'"},{"fix":"Set the GOOGLE_APPLICATION_CREDENTIALS env var or provide 'keyFilename' in the configuration.","cause":"No Google Cloud credentials configured (e.g., missing GOOGLE_APPLICATION_CREDENTIALS environment variable or keyFilename).","error":"Error: Could not load the default credentials"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"multer-storage","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}}