diff --git a/src/client/client.ts b/src/client/client.ts index 096b382..806482d 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -101,7 +101,7 @@ router.get('/:dataType', const dataType = req.params.dataType as keyof typeof path const selection = data.select([sum('kills').as('kills'), sum('deaths').as('deaths'), sum('deaths_with_weapon').as('deaths_while_equipped'), path[dataType], sum('total_distance').as('total_distance'), max('max_distance').as('max_distance')]).groupBy(path[dataType]) - const test = (await selection.execute()).reduce>((acc, curr) => { + const result = (await selection.execute()).reduce>((acc, curr) => { acc[curr[path[dataType]]] = { kills: Number(curr.kills), deaths: Number(curr.deaths), @@ -111,7 +111,10 @@ router.get('/:dataType', } return acc }, {}) - res.send(test) + const dataString = JSON.stringify(result) + const buffer = Buffer.from(dataString) + const size = buffer.length + res.status(200).setHeader('X-File-Size', size).setHeader('Content-Type', 'application/json').send(buffer) })() })