diff --git a/index.js b/index.js index a7fb771..f0d5f9a 100644 --- a/index.js +++ b/index.js @@ -162,6 +162,14 @@ var vidStreamer = function (req, res) { stream = stream.pipe(new Throttle(settings.throttle)) } + res.on('close', function(){ + stream.close(); + }); + + res.on('finish', function(){ + stream.close(); + }); + stream.pipe(res); return true; };