From a6da059439614c399b79c09ea1d406a3e4300b27 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Wed, 10 Mar 2021 18:48:01 +0300 Subject: [PATCH] Fix max listeners exceeded warning --- stream.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stream.js b/stream.js index ea3cb31..e8ba39d 100644 --- a/stream.js +++ b/stream.js @@ -10,6 +10,9 @@ var pipeline = require('stream').pipeline; module.exports = function probeStream(src, keepOpen) { var proxy = new PassThrough(); + // increase max number of listeners to stop memory leak warning + proxy.setMaxListeners(Object.keys(parsers).length + 10); + var result = new Promise(function (resolve, reject) { src.on('error', reject); proxy.on('error', reject);