0
我从Busboy获取文件流,然后我需要计算字节数,抓住第一行然后将其发送到天蓝色的存储。它适用于大约25MB的文件,但之后所有字节都不计算在内。我不知道如何让它等待。我正在使用传递流来保存原始数据,同时获得第一行。从Busboy流中计算字节
busboy
.on('file', function(fieldname, file, filename, encoding, mimetype) {
file
.on('data', function(data) {
bytes = bytes + data.length;
})
.on('end', function() {
console.log("end");
})
.pipe(passthrough)
.pipe(firstLine)
.pipe(es.wait(function (err, body) {
blobService.createBlockBlobFromStream(containter, name, passthrough, bytes, function (error, result) {
if(error) {
return sendResponse(error.toString(), res, null);
}
sendResponse(null, res, "done");
});
}));
})
.on('finish', function() {
console.log("busboy done");
});