I would like to create a basic video streaming server with usage statistics, using node.js,
the video source is a local file. The streaming works as expected with this:
fs.createReadStream("file.mp4").pipe(res);
But I would like to get some usage statistics, so I added a passThrough stream,
const stats = new PassThrough();
for the statistics I will add some code to the stats stream data event like this
//stats.on('data',(chunk)=> { });
But now the video is not streaming any more when I pipe it to the stats stream
fs.createReadStream("file.mp4").pipe(stats).pipe(res);
can you tell me please what I'm missing here?