emptyDir

import { emptyDir } from "jsr:@ende/fs";

function

async function emptyDir(dir: string | URL): Promise<void>

Asynchronously ensures that a directory is empty.

If the directory does not exist, it is created. The directory itself is not deleted.

Requires --allow-read and --allow-write permissions.

dir: string | URL

The path of the directory to empty, as a string or URL.

Returns

A void promise that resolves once the directory is empty.

Example: Usage

import { emptyDir } from "@ende/fs/empty-dir";

await emptyDir("./foo");

See also

Source