Knowledge Base


« Object Store Dev Docs

pkgcloud library for NodeJS

Getting pkgcloud on NodeJS to work with the CloudVPS Object Store using the rackspace driver is trivial, just use the following code to create.

(pkgcloud <0.9.x):

var client = require('pkgcloud').storage.createClient(
{
  provider: 'rackspace',
  authUrl: 'https://identity.stack.cloudvps.com/',
  username: 'YOUR_USERNAME',
  password: 'YOUR_PASSWORD'
}
);

(pkgcloud >0.9.x):

var client = require('pkgcloud').storage.createClient(
{
  provider: 'rackspace',
  authUrl: 'https://identity.stack.cloudvps.com/',
  username: 'YOUR_USERNAME',
  password: 'YOUR_PASSWORD',
  region : 'NL',
  strictSSL : false
}
);
// list the containers as a proof of concept
client.getContainers(function(err, containers)
{
for( var i=0; i&amp;amp;lt;containers.length; i++ ) {
  console.log(containers.name);
}
}
)

If for any reason, you prefer to depend on our S3 emulation, that will work, too. Once you've created an S3 credential pair in the CloudVPS interface, use the following snippet to create an S3 client:

var client = require('pkgcloud').storage.createClient(
{
  provider: 'amazon',
  serversUrl: 'YOUR_PROJECTID.objectstore.eu',
  accessKeyId: 'YOUR_ACCESSKEY',
  accessKey: 'YOUR_SECRETKEY'
}
);
VPS Bestellen
VPS Bestellen