ensureFile
import { ensureFile } from "jsr:@ende/fs";function
async function ensureFile(filePath: string | URL): Promise<void>Asynchronously ensures that the file exists.
If the file already exists, this function does nothing. If the parent directories for the file do not exist, they are created.
Requires --allow-read and --allow-write permissions.
filePath: string | URLThe path of the file to ensure, as a string or URL.
Returns
A void promise that resolves once the file exists.
Example: Usage
import { ensureFile } from "@ende/fs/ensure-file";
await ensureFile("./folder/targetFile.dat");
See also
https://docs.ende.sh/runtime/manual/basics/permissions#file-system-access for more information on Ende's permissions system.