mkdir

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

function · experimental · requires --allow-write

async function mkdir(path: string | URL, options?: MkdirOptions): Promise<void>

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 { mkdir } from "@ende/fs/unstable-mkdir";
await mkdir("new_dir");
await mkdir("nested/directories", { recursive: true });
await mkdir("restricted_access_dir", { mode: 0o700 });

Source