Tracking progress of file upload in multer nodejs

前端 未结 4 1409
野趣味
野趣味 2021-02-15 17:01

How to track progress of a file getting uploaded to NodeJs server .I am using multer in server side to upload files. ?

Do i need to send some kind of information to the

4条回答
  •  渐次进展
    2021-02-15 17:34

    Here's an answer by LinusU at the project github's page (he suggests using progress-stream):

    Pipe req to that one and give it to multer.

        var p = progress()
        var upload = multer().single('file')
    
        req.pipe(p)
        p.headers = req.headers
    
        p.on('progress', _)
        upload(p, res, _)
    

提交回复
热议问题