Node.js progress indicator feedback

后端 未结 2 520
花落未央
花落未央 2021-01-03 07:17

I have a question about the progress of sending with Node.js \'request\'. I have a Node.js application that acts as a proxy, actually forwarding a body to another server. I

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-03 07:33

    Solution for first part was in r.req.connectin.bytesWritten

    var r = request(requestOptions, function (error, response, body) {
        clearInterval(q);
        ...
    });
    
    var q = setInterval(function () {
        console.log("Uploaded: " + r.req.connection.bytesWritten);
    }, 250);
    

提交回复
热议问题