Registry / storage / openstack-swift-client

openstack-swift-client

JSON →
library2.3.1jsnpmunverified

A Node.js client library for connecting to OpenStack Swift object storage servers. Version 2.3.1 requires Node >=4 and ships TypeScript type definitions. Supports SwiftAuthenticator (Rackspace-style) and Keystone V3 authentication. Forked from the original swift-client package. Provides container and object CRUD operations with streaming support. Not actively maintained — last release in 2020.

npm install openstack-swift-client
INSTALL
IMPORT
SIG · OPENSTACK-SWIFT-CL
O
openstack-swift-client
storagejavascriptv2.3.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.

SwiftClient
import SwiftClient from 'openstack-swift-client'
import { SwiftClient } from 'openstack-swift-client'
SwiftClient is the default export; named import does not work.
SwiftAuthenticator
import SwiftClient from 'openstack-swift-client'; const { SwiftAuthenticator } = SwiftClient
import { SwiftAuthenticator } from 'openstack-swift-client'
SwiftAuthenticator is a static property on the SwiftClient default export.
KeystoneV3Authenticator
import SwiftClient from 'openstack-swift-client'; const { KeystoneV3Authenticator } = SwiftClient
import { KeystoneV3Authenticator } from 'openstack-swift-client'
KeystoneV3Authenticator is a static property on the SwiftClient default export.

Shows how to create a SwiftClient with SwiftAuthenticator, list containers, and upload a file.

import SwiftClient from 'openstack-swift-client'; const authenticator = new SwiftClient.SwiftAuthenticator( 'https://orbit.brightbox.com/v1/acc-xxx', 'cli-xxx', 'my-password' ); const client = new SwiftClient(authenticator); async function main() { const containers = await client.list(); console.log('Containers:', containers); const container = client.container('my-container'); const fileStream = require('fs').createReadStream('local-file.txt'); await container.put('remote-file.txt', fileStream); console.log('Upload done!'); } main().catch(console.error);
Debug
Known issues
gotchaSwiftClient constructor can also accept a URL, username, and password directly, but this pattern is deprecated and may be removed. Always use an authenticator instance.
fix
Always instantiate SwiftClient with an authenticator object: new SwiftClient(authenticator)
affects: >=2.0
breakingIn version 2.0, the default export changed from a factory function to the SwiftClient class. Using `require('openstack-swift-client')` now returns the class, not a factory.
fix
Update imports: use `import SwiftClient from 'openstack-swift-client'` or `const SwiftClient = require('openstack-swift-client')` and instantiate with `new SwiftClient(...)`.
affects: 2.x
deprecatedThe `SwiftClient#update(name, meta, extra)` method may be deprecated in future versions. Use `container.updateMeta(meta)` instead.
fix
Switch to container-scoped methods: `client.container(name).updateMeta(meta)`
affects: >=2.1
gotchaContainer names are case-sensitive in OpenStack Swift. Creating a container named 'MyContainer' and 'mycontainer' results in two different containers.
fix
Ensure consistent casing when creating and accessing containers.
affects: >=1.0
gotchaThe `SwiftClient#delete(name)` method does not delete non-empty containers. Attempting to delete a container with objects will throw an error.
fix
First delete all objects in the container, then delete the container.
affects: >=1.0
Errors
Common errors & fixes
TypeError: SwiftClient is not a constructor
Using `import { SwiftClient } from 'openstack-swift-client'` (named import) instead of default import.
fix
Use default import: `import SwiftClient from 'openstack-swift-client'`
Error: Container not empty
Attempting to delete a container that still contains objects.
fix
Delete all objects from the container first using `container.deleteAll()` or iterating over objects.
Authentication failed with status 401
Invalid credentials, expired token, or incorrect auth URL.
fix
Verify username/password, check auth URL format (e.g., 'https://orbit.brightbox.com/v1/acc-xxx'), and ensure credentials are correct.
Cannot find module 'openstack-swift-client'
Package not installed or incorrect import path.
fix
Run `npm install --save openstack-swift-client` and ensure import path matches package name.
Upgrade
Version history
2.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
13
OpenAI (training)
1
Resources