While this code works well for regular uploads, I am curious about how the resumable upload feature functions when a user loses connection during a large upload. Does simply setting 'resumable' to true in the writeStream options make it work effectively?
I have gone through the documentation on performing resumable uploads, and it seems that the functionality should be encapsulated within the createWriteStream function.
To test this, I turned off my wifi midway through an upload, but upon resuming, the time taken to complete the upload was the same as if it were uninterrupted. This has left me unsure if the resumable upload actually worked as intended.
If anyone can provide assistance or clarification on this matter, please feel free to let me know.
stream = remoteFile.createWriteStream({gzip: true, resumable: true, metadata: {contentType: file.mimetype} });
stream.on('error', (err: any) => {
next(err);
res.status(400).send('err');
});
stream.on('finish', () => {
res.status(200).send('Success!');
});
stream.end(file.buffer);