我从Busboy获得文件流,然后我需要计数字节,抓取第一行,然后将其发送到蔚蓝存储。它适用于高达25‘t的文件,但在此之后,所有的字节都不被计算在内。我不知道该怎么等。当我得到第一行时,我使用了一个直通流来保存原始数据。
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");
});发布于 2015-10-20 05:48:41
如果您想将数据输送到blob,createWriteStreamToBlockBlob是您可能需要的API。
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(blobService.createWriteStreamToBlockBlob(containter, name, function (error, result) {
if(error) {
return sendResponse(error.toString(), res, null);
}
sendResponse(null, res, "done");
}))
})
.on('finish', function() {
console.log("busboy done");
});https://stackoverflow.com/questions/33111406
复制相似问题