xxxxxxxxxx
//waitFor should be able to get you whether if a bucket does not exist.
var params = {
Bucket: 'STRING_VALUE' /* required */
};
s3.waitFor('bucketNotExists', params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
//If a bucket does not exist, then you can create it.
//Hope it helps.
xxxxxxxxxx
var params = {
Bucket: 'STRING_VALUE' /* required */
};
s3.waitFor('bucketNotExists', params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});