How to implement a resume pause functionality for file upload ? I am using node js, gridfs and multer

Viewed 360

I have used the following link to upload files in mongodb which is working in my application : https://dev.to/shubhambattoo/uploading-files-to-mongodb-with-gridfs-and-multer-using-nodejs-5aed

But I need to implement resume and pause functionality while uploading file. File can be of any extension (mostly webm). How do implement it for single file ?

Also if a file is paused, then how do I get the number of chunks uploaded in "fs.chunks" ? In "fs.files", we have the chunkSize maybe that could help ?

1 Answers

I solved this issue by first saving the file to fileSystem as we have "append" functionality in nodeJS file system. Once the file is completely loaded, then I am uploading it to mongoDB and deleting it from file system. As mongoDB, gridfs does not have append functionality.

Related