bluemix-object-storage
v2.0.1
Published
Easily manages the accounts, containers, and objects for the IBM Bluemix Object Storage service.
Downloads
42
Maintainers
Readme
bluemix-object-storage
Description
Easily manage the accounts, containers, and objects for the IBM Bluemix Object Storage service.
Install
$ npm install bluemix-object-storage --save
Usage
var ObjectStorage = require('bluemix-object-storage');
var os = new ObjectStorage('user_id', 'password', 'project_id', 'container_name', 'access_point_url');
os.createContainer()
.then(function(){
return os.setContainerPublicReadable();
})
.then(function(){
return os.uploadFileToContainer('fido.jpg', 'image/jpeg', buffer, 49057);
})
.then(function(file){
console.log('url to uploaded file:', file);
return os.listContainerFiles();
})
.then(function(files){
console.log('list of files in container:', files);
});
Access Points
- https://dal.objectstorage.open.softlayer.com
- https://lon.objectstorage.open.softlayer.com
API
Constructor(userId, password, projectId, containerName, accessPointUrl)
createContainer()
listContainerFiles()
setContainerPublicReadable()
uploadFileToContainer(filename, mimetype, buffer, filesize)
Test
$ git clone https://github.com/chyld/bluemix-object-storage
$ cd bluemix-object-storage
$ npm install
$ npm test
License
MIT © Chyld Medford