diff --git a/lib/apiswagger.js b/lib/apiswagger.js index cc392d4..794b99b 100644 --- a/lib/apiswagger.js +++ b/lib/apiswagger.js @@ -5,7 +5,7 @@ module.exports = (app, client) => { zlib = require('zlib'), { chain } = require('stream-chain'), { parser } = require('stream-json'), - { streamValues } = require('stream-json/streamers/StreamValues'), + { stringer } = require('stream-json/jsonl/Stringer'), { streamArray } = require('stream-json/streamers/StreamArray'), clean = str => { return str.replace(/[\/\\^$+?()`'¡¿¨!"·%&=;,\|\[\]{}]+/gmi, '') @@ -516,7 +516,6 @@ module.exports = (app, client) => { chain([ result, parser(), - streamValues(), data => data.value.hits.hits, streamArray(), data => ({ @@ -526,9 +525,9 @@ module.exports = (app, client) => { last: data.value._source.last, nodeinfo: data.value._source.nodeinfo }), - zlib.createGzip(), - res - ]) + stringer(), + zlib.createGzip() + ]).pipe(res, { end: true }) } catch (e) { console.error(e) res.status(404).end()