import { promises as fs } from "fs";
import path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const datasetsFile = path.resolve(__dirname, "../../data/datasets.json");

export async function listDatasets() {
  const raw = await fs.readFile(datasetsFile, "utf8");
  const datasets = JSON.parse(raw);
  return datasets;
}
