我试图弄清楚如何将上传数据进度发送回客户端。似乎此事件执行了两次,并且带有先前的进度。
form.addListener('progress', function(bytesReceived, bytesExpected) {
socket.sockets.on('connection', function(socket) {
socket.emit('Uploaded', {
progress : (bytesReceived / bytesExpected * 100).toFixed(0)
});
});
});