This commit is contained in:
parent
eb70fcbac9
commit
d3c6afa590
@ -500,18 +500,17 @@ module.exports = (app, client) => {
|
|||||||
*/
|
*/
|
||||||
app.use('/api/download_index', async (req, res) => {
|
app.use('/api/download_index', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const result = await client.search({
|
|
||||||
index: constant.index,
|
|
||||||
size: 9999,
|
|
||||||
query: {
|
|
||||||
match_all: {}
|
|
||||||
}
|
|
||||||
}, { asStream: true })
|
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
'Content-Type': 'application/x-gzip',
|
'Content-Type': 'application/x-gzip',
|
||||||
'Content-disposition': 'attachment; filename=fediblock-index.json.gz'
|
'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) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
res.status(404).end()
|
res.status(404).end()
|
||||||
|
Loading…
Reference in New Issue
Block a user