mkdirSync

import { mkdirSync } from "jsr:@ende/fs/unstable-mkdir";

function · experimental · requires --allow-write

function mkdirSync(path: string | URL, options?: MkdirOptions): void

Synchronously creates a new directory with the specified path.

Defaults to throwing error if the directory already exists.

Requires allow-write permission.

path: string | URL

The path to the new directory.

options?: MkdirOptions

Options for creating directories.

Example: Usage

import { mkdirSync } from "@ende/fs/unstable-mkdir";
mkdirSync("new_dir");
mkdirSync("nested/directories", { recursive: true });
mkdirSync("restricted_access_dir", { mode: 0o700 });

Source