I'm using the drive node library to upload files from my node.js app using readstreams. Here's the snippet of the code. I want to write some logic once my app gets the callback that the upload is complete. How do I find out when the upload is complete or failed? The callback to the drive.files.create doesn't seem to be right place. Does createReadStream gives me a callback?
var fileMetadata = {
name: "test.mp4",
parents: [folder_id]
};
var media = {
mimeType: mime_type,
body: fs.createReadStream(fileid)
};
drive.files.create({
resource: fileMetadata,
media: media
}, function(err, file) {
//continue processing after upload is complete
});