I want to split input stream into 2 stream. Because i am sending 2 image via file upload..
so in my controller i write like this
req.file('image')._files[0].stream
this contains details of 2 image. For example length shows sum of 2 images.
so what i want is soomething like below:
//calculate length of 1st image
var dataLength =0;
req.file('image')._files[0].stream.on('data', function (chunk) {
dataLength += chunk;
})
.on('end', function () { // done
console.log('The length of 1st was:', dataLength);
});
//calculate length of 2nd image
var dataLength2 =0;
req.file('image')._files[0].stream.on('data', function (chunk) {
dataLength2 += chunk;
})
.on('end', function () { // done
console.log('The length of 2nd was:', dataLength2);
});
what change should i made? How can i achieve this?