Registry /
storage / filesystem-storage-pkgcloud
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.
filesystem-storage-pkgcloud
✓ const filesystem = require('filesystem-storage-pkgcloud');
✗ const filesystem = require('filesystem-storage-pkgcloud').default;
CommonJS module; no default export.
pkgcloud.providers.filesystem.storage
✓ pkgcloud.providers.filesystem.storage = require('filesystem-storage-pkgcloud');
✗ import filesystem from 'filesystem-storage-pkgcloud'; pkgcloud.providers.filesystem.storage = filesystem;
ESM import may not work; use require for pkgcloud integration.
createClient
✓ const client = require('filesystem-storage-pkgcloud').createClient({ root: '/tmp/storage' });
✗ const client = new require('filesystem-storage-pkgcloud').Client({ root: '/tmp/storage' });
createClient is a static factory function, not a constructor.
Shows how to register the filesystem provider with pkgcloud, upload a file, and list containers.
const fs = require('fs');
const path = require('path');
const pkgcloud = require('pkgcloud');
const filesystemProvider = require('filesystem-storage-pkgcloud');
pkgcloud.providers.filesystem = {};
pkgcloud.providers.filesystem.storage = filesystemProvider;
const client = pkgcloud.storage.createClient({
provider: 'filesystem',
root: path.join(__dirname, 'test-storage')
});
// Ensure root directory exists
if (!fs.existsSync(client.config.root)) {
fs.mkdirSync(client.config.root, { recursive: true });
}
// Upload example
const container = 'test-container';
const remoteFile = 'hello.txt';
const localFile = path.join(__dirname, 'hello.txt');
fs.writeFileSync(localFile, 'Hello World!');
client.upload({
container: container,
remote: remoteFile,
local: localFile
}, function(err, result) {
if (err) return console.error(err);
console.log('Uploaded:', result);
// Cleanup
fs.unlinkSync(localFile);
fs.rmdirSync(path.join(client.config.root, container), { recursive: true });
});
// List containers
client.getContainers(function(err, containers) {
if (err) return console.error(err);
console.log('Containers:', containers);
});
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '/nonexistent/file.txt'
Attempting to read a file that does not exist in the storage root.
fixEnsure the file exists before reading, or check for existence with client.getFile()
TypeError: client.createClient is not a function
Using require('filesystem-storage-pkgcloud').createClient directly when it is an object with createClient property.
fixUse require('filesystem-storage-pkgcloud').createClient(...) correctly. Audit
Dependencies
csvoptionalCSV parsing dependency via loopback-storage-service