1

My Node.js server is successfully connected to IBM Cloud Object Storage. I can create buckets and upload images using the cos.putObject function. The images appears in the dashboard.

Here's how I upload an Image:

(It's working, I can see the images on the IBM Cloud Object Storage Dashboard inside the selected bucket)

function createTextFile(bucketName, itemName, fileText) {
    console.log(`Creating new item: ${itemName}`);
    return cos.putObject({
        Bucket: bucketName, 
        Key: itemName, 
        Body: fileText
    }).promise()
    .then((data) => {
        console.log(`Item: ${itemName} created!`);
     function(err,url){
          if(err){
            console.log("err",err);
          }
        });

    })
    .catch((e) => {
        console.log(`ERROR: ${e.code} - ${e.message}\n`);
    });
}

The question is, how do I retrieve the URL of an images through Nodejs to display them into my front-end?

I can't find a good documentation for that. Please help! Thanks.

Adam
  • 43
  • 5
  • Your question is similar to this one: https://stackoverflow.com/questions/36338324/public-urls-for-objects-in-bluemix-object-storage-service – Dr G. Aug 26 '18 at 13:03

0 Answers0