I am using google storage api for saving a file in gcp bucket in a async function. I want to wait till I get a error or success in callback, only then I want to proceed with other lines of code but I am getting LastMessage before success or error.
https://googleapis.dev/nodejs/storage/latest/File.html#save
await file.save(jsonData.trim(), {resumable : false}, function(error) {
if (error) {
console.log('error');
} else {
console.log('success');
}
})
console.log( "LastMessage: Error or Success is received, only then log this message")
.save()returns a promise when you pass a callback? If not, there's nothing theawaitwill wait for.