Check if bucket exists
Updated at:2025-11-03
Check if bucket exists
-
Basic workflow
- Create a BosClient instance.
- Run the doesBucketExist() method.
-
Example code
JavaScript1client.doesBucketExist(<BucketName>) //Specify the bucket name 2 .then(function(response) { 3 if(response) { 4 console.log('Bucket exists'); 5 } 6 else { 7 console.log('Bucket not exists'); 8 } 9 }) 10 .catch(function() { 11 // Query failed, add your own code to handle the exception 12 });
