{"id":48607,"library":"multer-aliyun-oss","title":"multer-aliyun-oss","description":"Multer storage engine for AliYun OSS (Object Storage Service). Current stable version 2.1.3. Allows uploading files directly to Alibaba Cloud OSS via multer middleware in Express-like Node.js apps. Provides configurable bucket, region, credentials, and optional destination/filename functions. No native TypeScript types; relies on @ali-oss SDK. Suitable for Node.js backend apps using Alibaba Cloud ecosystem.","status":"active","version":"2.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/ay86/multer-aliyun-oss","tags":["javascript","multer","storage","aliyun","oss"],"install":[{"cmd":"npm install multer-aliyun-oss","lang":"bash","label":"npm"},{"cmd":"yarn add multer-aliyun-oss","lang":"bash","label":"yarn"},{"cmd":"pnpm add multer-aliyun-oss","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for interacting with AliYun OSS API","package":"@ali-oss","optional":false},{"reason":"Peer dependency; the storage engine is used with multer","package":"multer","optional":false}],"imports":[{"note":"Package is CommonJS only, no ESM export. Use require().","wrong":"import MAO from 'multer-aliyun-oss'; // ESM not supported","symbol":"default","correct":"const MAO = require('multer-aliyun-oss');"},{"note":"MAO is a function that returns a storage engine object, not a class.","wrong":"const upload = multer({ storage: new MAO({...}) }); // MAO is not a constructor","symbol":"default","correct":"const upload = multer({ storage: MAO({...}) });"},{"note":"If set as string, it's used directly; but to mimic multer DiskStorage, use function.","wrong":"destination: '/uploads' // will be ignored; must use function or empty string","symbol":"destination","correct":"destination: (req, file, cb) => cb(null, 'uploads/')"}],"quickstart":{"code":"const express = require('express');\nconst multer = require('multer');\nconst MAO = require('multer-aliyun-oss');\n\nconst app = express();\n\nconst upload = multer({\n    storage: MAO({\n        config: {\n            region: process.env.OSS_REGION ?? '',\n            accessKeyId: process.env.OSS_ACCESS_KEY_ID ?? '',\n            accessKeySecret: process.env.OSS_ACCESS_KEY_SECRET ?? '',\n            bucket: process.env.OSS_BUCKET ?? '',\n        },\n        destination: 'uploads',\n        filename: (req, file, cb) => {\n            cb(null, Date.now() + '-' + file.originalname);\n        }\n    })\n});\n\napp.post('/upload', upload.single('file'), (req, res) => {\n    console.log(req.file);\n    res.send('OK');\n});\n\napp.listen(3000);","lang":"javascript","description":"Express server with single file upload to AliYun OSS using multer middleware."},"warnings":[{"fix":"Double-check property names and ensure environment variables are set correctly.","message":"The package expects config props 'region', 'accessKeyId', 'accessKeySecret', 'bucket' exactly; typos cause silent auth failures.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Access file properties inside callback: cb(null, 'images/' + file.fieldname);","message":"destination option as function receives (req, file, callback) but does NOT provide file.mimetype etc. properties during callback. Use req/file as needed.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Monitor @ali-oss upgrade notes and test compatibility.","message":"The underlying @ali-oss SDK may change; this package may need updates for newer OSS API versions.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.1.3':17 'ali':51 'ali-oss':50 'alibaba':23,60 'aliyun':3,9,66 'allow':18 'app':34,58 'backend':57 'bucket':37 'cloud':24,61 'configur':36 'credenti':39 'current':14 'destination/filename':42 'direct':21 'ecosystem':62 'engin':7 'express':31 'express-lik':30 'file':20 'function':43 'javascript':63 'like':32 'middlewar':28 'multer':2,5,27,64 'multer-aliyun-oss':1 'nativ':45 'node.js':33,56 'object':11 'option':41 'oss':4,10,25,52,67 'provid':35 'region':38 'reli':48 'sdk':53 'servic':13 'stabl':15 'storag':6,12,65 'suitabl':54 'type':47 'typescript':46 'upload':19 'use':59 'version':16 'via':26","created_at":"2026-06-07T16:57:30.934448+00:00","updated_at":"2026-06-07T16:57:30.934448+00:00","problems":[{"fix":"Ensure 'config' object contains region, accessKeyId, accessKeySecret, and bucket strings.","cause":"config object is missing or misspelled properties.","error":"TypeError: Cannot read property 'region' of undefined"},{"fix":"Use 'multers()' (no new).","cause":"Attempting to use 'new MAO()' instead of calling as a function.","error":"TypeError: MAO is not a constructor"},{"fix":"Check destination path and ensure writable permissions. Use absolute path or empty destination to use root.","cause":"Incorrect destination path; this package tries to create a local temp file before uploading? Actually it streams directly, but this error may appear if the OS cannot handle streaming.","error":"Error: ENOENT: no such file or directory, open '...'"}],"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/ay86/multer-aliyun-oss#readme","github":"https://github.com/ay86/multer-aliyun-oss","docs":null,"changelog":null,"pypi":null,"npm":"multer-aliyun-oss","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}}