ensureDirSync

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

function

function ensureDirSync(dir: string | URL): void

Synchronously ensures that the directory exists, like mkdir -p.

If the directory already exists, this function does nothing. If the directory does not exist, it is created.

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

dir: string | URL

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

Returns

A void value that returns once the directory exists.

Example: Usage

import { ensureDirSync } from "@ende/fs/ensure-dir";

ensureDirSync("./bar");

See also

Source