emptyDirSync

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

function

function emptyDirSync(dir: string | URL): void

Synchronously ensures that a directory is empty deletes the directory contents it is not 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 value that returns once the directory is empty.

Example: Usage

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

emptyDirSync("./foo");

See also

Source