'How to implement a resume pause functionality for file upload ? I am using node js, gridfs and multer
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 ?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sharon |