From 35f3097b8ea8b7fda8aea14666e1391f76fd5475 Mon Sep 17 00:00:00 2001 From: ale Date: Mon, 14 Oct 2024 00:06:47 +0200 Subject: [PATCH] stream-json --- lib/apiswagger.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/apiswagger.js b/lib/apiswagger.js index afb36b7..294c4bb 100644 --- a/lib/apiswagger.js +++ b/lib/apiswagger.js @@ -1,5 +1,3 @@ -const nodeinfo = require('activitypub-express/pub/nodeinfo') - module.exports = (app, client) => { const constant = require('./constant'), zlib = require('zlib'), @@ -479,17 +477,17 @@ module.exports = (app, client) => { }, { asStream: true, meta: false }), instancescomment = [], block_count = 0, - pipeline = chain([ - parser(), - pick({ filter: 'hits.hits' }), - streamArray(), - data => { - block_count++ - instancescomment.push({ - instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment - }) - } - ]) + pipeline = chain([ + parser(), + pick({ filter: 'hits.hits' }), + streamArray(), + data => { + block_count++ + instancescomment.push({ + instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment + }) + } + ]) result.pipe(pipeline) res.json({ block_count,