@baqhub/cli
Version:
The official command line interface for the BAQ federated app platform.
14 lines (13 loc) • 541 B
JavaScript
import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
const cachePath = path.join(os.homedir(), ".baq", "cache");
export async function readFromCache(hash) {
const filePath = path.join(cachePath, `${hash}.json`);
return await fs.readFile(filePath, { encoding: "utf8" });
}
export async function writeToCache(hash, content) {
const filePath = path.join(cachePath, `${hash}.json`);
await fs.mkdir(cachePath, { recursive: true });
await fs.writeFile(filePath, content);
}