@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
13 lines • 533 B
JavaScript
import { FileStat, FileType } from "../../types.js";
import { enoent } from "../../errors/fs.js";
import { parts } from "./pathing.js";
/** A path's stat: the row its parent's listing names. */
export function stat(accessor, path, entry = null) {
if (parts(accessor, path).length === 0) {
return Promise.resolve(new FileStat({ name: '/', type: FileType.DIRECTORY, size: 0 }));
}
if (entry === null)
return Promise.reject(enoent(path));
return Promise.resolve(entry);
}
//# sourceMappingURL=stat.js.map