Something went wrong. Try again.
COSMO is a tool for exploring astronomical data from the Gaia catalog. tedius.tngl.sh/cosmo
Something went wrong. Try again.
123456789101112131415161718192021222324252627export type Preset = { name: string; description: string; /** Path to a static asset, fetched from "public/" */ url: string;};
export const EXAMPLE_PRESET: Preset = { name: "Example", description: "A large Gaia DR3 VizieR export, ready to explore.", url: `${import.meta.env.BASE_URL}examples/m45.tsv`,};
/** * Downloads a preset file as a File named after its url, ready for DropFile. * Throws an Error with a user-facing message on failure. */export async function fetchPreset(preset: Preset = EXAMPLE_PRESET): Promise<File> { const res = await fetch(preset.url); if (!res.ok) { throw new Error(`Couldn't load the preset file (${res.status}).`); } // A Blob, not an ArrayBuffer, so the bytes are copied once, when the parse reads them. // The name is only a hint for the parser, content decides the real format. return new File([await res.blob()], preset.url.split("/").pop() ?? preset.url);}