Registry / storage / multer-storage-pkgcloud

multer-storage-pkgcloud

JSON →
library1.2.1jsnpmunverified

A multer storage plugin for uploading files to cloud object storage providers supported by pkgcloud (e.g., OpenStack, Amazon S3, Rackspace). Version 1.2.1 is the latest stable release. The package wraps pkgcloud's client to provide a drop-in multer storage engine. It requires multer >= 1.0.0 and pkgcloud itself. Minimal configuration: just a pkgcloud client and optional container/destination customization. Compared to other multer storage plugins (like multer-s3), this one is provider-agnostic via pkgcloud.

npm install multer-storage-pkgcloud
INSTALL
IMPORT
SIG · MULTER-STORAGE-PKG
M
multer-storage-pkgcloud
storagejavascriptv1.2.1
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.

pkgcloudStorage
const pkgcloudStorage = require('multer-storage-pkgcloud')
import pkgcloudStorage from 'multer-storage-pkgcloud'
Package uses CommonJS only; no default export for ESM. Use require.
pkgcloudStorage
const pkgcloudStorage = require('multer-storage-pkgcloud')
const { pkgcloudStorage } = require('multer-storage-pkgcloud')
Module exports storage function directly, not as named export.
multer
const multer = require('multer')
import multer from 'multer'
Multer also CommonJS-based; ESM may work but not guaranteed.

Shows how to set up a multer middleware with pkgcloud storage for file uploads using OpenStack, including client creation and destination function.

const express = require('express'); const multer = require('multer'); const pkgcloud = require('pkgcloud'); const pkgcloudStorage = require('multer-storage-pkgcloud'); const client = pkgcloud.storage.createClient({ provider: 'openstack', username: process.env.OS_USERNAME ?? '', password: process.env.OS_PASSWORD ?? '', authUrl: process.env.OS_AUTH_URL ?? '', region: process.env.OS_REGION ?? '' }); const storage = pkgcloudStorage({ client: client, destination: function (req, file, cb) { cb(null, { container: 'my-container', remote: 'uploads/' + file.originalname }); } }); const upload = multer({ storage: storage }); const app = express(); app.post('/upload', upload.single('file'), (req, res) => { res.send('File uploaded successfully'); }); app.listen(3000);
Debug
Known issues
breakingRequires multer >= 1.0.0; older multer versions are incompatible.
fix
Upgrade multer to version 1.0.0 or higher.
affects: <1.0.0
deprecatedThe package is no longer actively maintained; last release was in 2016.
fix
Consider using alternative multer storage plugins like multer-s3 or multer-google-cloud-storage.
affects: all
gotchapkgcloud library itself is deprecated and no longer maintained; may have unpatched vulnerabilities.
fix
Switch to cloud-specific SDKs (e.g., @aws-sdk/client-s3 for S3) and use corresponding multer storage plugins.
affects: all
gotchaFile naming collision: Without a custom destination function, files with the same originalname will overwrite each other in the container.
fix
Use the destination function to generate unique remote paths, e.g., `${Date.now()}-${file.originalname}`.
affects: all
gotchaNo error handling for failed uploads; errors from pkgcloud are passed through but may be hard to debug.
fix
Wrap multer middleware in try-catch or implement multer error handling (e.g., multer error middleware).
affects: all
Errors
Common errors & fixes
Error: MulterError: Unexpected field
Mismatch between form field name and multer configuration (e.g., using upload.single('file') but form has field 'fieldname').
fix
Ensure the field name in multer configuration matches the form input name exactly.
TypeError: Cannot read property 'storage' of undefined
The pkgcloud client was not properly created or passed as undefined to pkgcloudStorage().
fix
Verify client is created with valid credentials and passed as { client: client } (not just client alone).
Error: Container not found: uploads
The default container 'uploads' does not exist in the cloud provider.
fix
Either create the container 'uploads' beforehand or specify a different container in destination function.
Error: ENOTFOUND in pkgcloud request
Network error; pkgcloud could not reach the storage provider endpoint (e.g., auth URL incorrect or no internet).
fix
Check the authUrl and region; ensure connectivity to the endpoint.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies
multerrequiredMulter storage plugin – must be used with multer >= 1.0.0
pkgcloudrequiredProvides cloud storage client (OpenStack, S3, etc.)
Agent activity
25 hits · last 30 days
node
24
Amazon
1
Resources
multer-storage-pkgcloud — npm install multer-storage-pkgcloud · libregistry