Registry / storage / loopback-component-storage

loopback-component-storage

JSON →
library3.7.0jsnpmunverified

LoopBack storage component provides Node.js and REST APIs to manage binary file contents using pluggable storage providers such as local file systems, Amazon S3, Azure, Google Cloud, Openstack, and Rackspace. It uses pkgcloud for cloud-based storage support. Current stable version is 3.7.0. The package is in Maintenance LTS mode since Dec 2016 with EOL Dec 2020. It is part of LoopBack 3 ecosystem and is now deprecated in favor of LoopBack 4. Key differentiators: simple API for file upload/download, seamless integration with LoopBack models, and support for multiple cloud providers via pkgcloud.

npm install loopback-component-storage
INSTALL
IMPORT
SIG · LOOPBACK-COMPONENT
L
loopback-component-storage
storagejavascriptv3.7.0
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.

component
const component = require('loopback-component-storage');
import component from 'loopback-component-storage';
This package is CommonJS-only; no ESM exports.
StorageService
const StorageService = require('loopback-component-storage').StorageService;
import { StorageService } from 'loopback-component-storage';
CommonJS require destructuring; no native ESM support.
StorageModel
const storageComponent = require('loopback-component-storage'); storageComponent.attachTo(app, options);
app.use(require('loopback-component-storage'));
The component is attached via attachTo, not as middleware. The docs show usage with loopback datasources.

Attaches the storage component to a LoopBack application using a local filesystem provider.

const loopback = require('loopback'); const storageComponent = require('loopback-component-storage'); const app = loopback(); const ds = loopback.createDataSource('storage', { provider: 'filesystem', root: '/tmp/storage' }); storageComponent.attachTo(app, { dataSource: ds, // Optionally configure ACLs, containers, etc. }); app.start = function() { return app.listen(3000, () => { app.emit('started'); console.log('Web server listening at', app.get('url')); }); }; if (require.main === module) app.start();
Debug
Known issues
deprecatedLoopBack 3 is in Maintenance LTS mode; migration to LoopBack 4 is strongly recommended.
fix
Migrate to LoopBack 4 storage component: https://loopback.io/doc/en/lb4/migration-overview.html
affects: >=3.0.0
breakingNode.js >=8 required. Older Node.js versions are not supported.
fix
Upgrade Node.js to >=8 or use an older version of the component.
affects: >=3.0.0
gotchaThe component attaches via attachTo, not as standard middleware; common mistake is to use app.use().
fix
Use storageComponent.attachTo(app, options) as shown in the quickstart.
affects: >=3.0.0
gotchaCloud provider credentials (e.g., AWS keys) must be set in environment or datasource config; missing credentials cause silent failures.
fix
Ensure provider-specific environment variables (e.g., AWS_ACCESS_KEY_ID) are set.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'pkgcloud'
Missing pkgcloud dependency; not installed automatically.
fix
Run: npm install pkgcloud
TypeError: app.use is not a function
Attempting to use storage component as middleware instead of calling attachTo.
fix
Call storageComponent.attachTo(app, options) instead of app.use(...)
Error: Container /tmp/storage does not exist
Filesystem provider root directory doesn't exist.
fix
Create the root directory: mkdir -p /tmp/storage
Upgrade
Version history
3.7.0latest on npm
Audit
Dependencies
pkgcloudrequiredUsed for cloud storage provider abstraction (Amazon S3, Azure, etc.)
Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
loopback-component-storage — npm install loopback-component-storage · libregistry