gzip download
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ale 2024-09-22 06:23:28 +02:00
parent eb70fcbac9
commit d3c6afa590

View File

@ -500,18 +500,17 @@ module.exports = (app, client) => {
*/
app.use('/api/download_index', async (req, res) => {
try {
const result = await client.search({
index: constant.index,
size: 9999,
query: {
match_all: {}
}
}, { asStream: true })
res.writeHead(200, {
'Content-Type': 'application/x-gzip',
'Content-disposition': 'attachment; filename=fediblock-index.json.gz'
})
result.pipe(zlib.createGzip()).pipe(res, { end: true })
(await client.search({
index: constant.index,
size: 9999,
query: {
match_all: {}
}
}, { asStream: true })).pipe(zlib.createGzip()).pipe(res, { end: true })
} catch (e) {
console.error(e)
res.status(404).end()