OBS provides object storage service through simple web service interfaces and applies to Internet applications. The object storage service is accessed and operated using the REST APIs that support standard HTTP headers and status codes.
Complete official documentation can be found here.
yarn add t-systems-obs-sdk
// Import the OBS library.
var ObsClient = require('t-systems-obs-sdk');
// Create an instance of ObsClient.
var obsClient = new ObsClient({
access_key_id: '*** Provide your Access Key ***',
secret_access_key: '*** Provide your Secret Key ***',
server : 'yourdomainname'
});
// Use the instance to access OBS.
// Close obsClient.
obsClient.close();
obsClient.createBucket({
Bucket : 'bucketname',
}, (err, result) => {
if(err){
console.error('Error-->' + err);
}else{
console.log('Status-->' + result.CommonMsg.Status);
}
});
obsClient.putObject({
Bucket : 'bucketname',
Key : 'objectkey',
Body : 'Hello OBS'
}, (err, result) => {
if(err){
console.error('Error-->' + err);
}else{
console.log('Status-->' + result.CommonMsg.Status);
}
});
obsClient.getObject({
Bucket : 'bucketname',
Key : 'objectkey'
}, (err, result) => {
if(err){
console.error('Error-->' + err);
}else{
console.log('Status-->' + result.CommonMsg.Status);
if(result.CommonMsg.Status < 300 && result.InterfaceResult){
console.log(result.InterfaceResult.Content.toString());
}
}
});
Refer to official documentation for more examples.
No contribution welcome at this time.