mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
26 lines
677 B
TypeScript
26 lines
677 B
TypeScript
import { Region } from '../../constants/regions';
|
|
import { BkrlDiscriminatedEntries, BkrlReadStream } from '../streams/bkrl';
|
|
import { asset } from './asset';
|
|
|
|
const cache: Record<Region, Record<number, BkrlDiscriminatedEntries>> = {
|
|
asia: {},
|
|
eu: {},
|
|
com: {},
|
|
};
|
|
|
|
export async function getArchivedRatingLeaderboard(
|
|
region: Region,
|
|
season: number,
|
|
) {
|
|
if (!cache[region][season]) {
|
|
const info = await fetch(
|
|
asset(`regions/${region}/rating/${season}/latest.bkrl`),
|
|
)
|
|
.then((response) => response.arrayBuffer())
|
|
.then((buffer) => new BkrlReadStream(buffer).bkrl());
|
|
cache[region][season] = info;
|
|
}
|
|
|
|
return cache[region][season];
|
|
}
|