UNPKG

recoder-code

Version:

🚀 AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!

14 lines (13 loc) • 440 B
import { promises as fsPromises } from "fs"; const { readFile } = fsPromises; export const filePromisesHash = {}; export const fileIntercept = {}; export const slurpFile = (path, options) => { if (fileIntercept[path] !== undefined) { return fileIntercept[path]; } if (!filePromisesHash[path] || options?.ignoreCache) { filePromisesHash[path] = readFile(path, "utf8"); } return filePromisesHash[path]; };