httpUploadProgress is not working as expected for Buffer data? httpUploadProgress is not working as expected for Buffer data? express express

httpUploadProgress is not working as expected for Buffer data?


first check if you have updated library to the latest version and Try Modifying your code with this one:

.on('httpUploadProgress',function(progress) {    console.log(Math.round(progress.loaded/progress.total*100)+ '% done');    });


I am not exactly sure what is going on, but i think this one helps with your problem. Although, the variables used in this are from another similar source. Try adopting the method.

ss(socket).emit('strimage', stream, {size: file.size,name: fileName,email: emailid});//initialize var to 0                    var blobStream = ss.createBlobReadStream(file);                    var size = 0;                    var uploadedSize;                    blobStream.on('data', function(chunk) {                      size += chunk.length;//try giving an upload size                        uploadedSize = Math.floor(size / file.size * 100)                      console.log(uploadedSize + '%');                        if (uploadedSize == 100) {                            console.log("inside uploadedSize");                            socket.emit('uploadcomplete', data);                        }                    });                    blobStream.pipe(stream);