compress the mf (#1267)

This commit is contained in:
NotSoToothless
2026-05-24 19:44:12 -07:00
committed by GitHub
parent 99a43e398e
commit 9c6ca3bcd7
7 changed files with 50 additions and 41 deletions
+3 -3
View File
@@ -27,7 +27,7 @@ const TSS_BATTLES_DB_PATH = path.join(STORAGE_ROOT, 'tss_battles.db');
fs.mkdirSync(REPLAYS_PATH, { recursive: true });
function replayDataPath(sessionId) {
return path.join(REPLAYS_PATH, String(sessionId).toLowerCase(), 'replay_data.json');
return path.join(REPLAYS_PATH, String(sessionId).toLowerCase(), 'replay_data.json.gz');
}
const app = express();
@@ -1443,7 +1443,7 @@ function readReplayJson(sessionId) {
return null;
}
try {
return JSON.parse(fs.readFileSync(replayPath, 'utf-8'));
return JSON.parse(zlib.gunzipSync(fs.readFileSync(replayPath)));
} catch (err) {
log.warn('Failed to read replay JSON', { sessionId, error: err.message });
return null;
@@ -2753,7 +2753,7 @@ app.get('/api/match/:sessionId/replay', (req, res) => {
}
try {
const data = JSON.parse(fs.readFileSync(replayPath, 'utf-8'));
const data = JSON.parse(zlib.gunzipSync(fs.readFileSync(replayPath)));
res.json({
available: true,
session_id: sessionId,