Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/fs.ts>ensureDir

A JavaScript extension package for building strong and modern applications.
Latest
function ensureDir
import { ensureDir } from "https://deno.land/x/ayonli_jsext@v0.9.72/fs.ts";

Ensures the directory exists, creating it (and any parent directory) if not.

Examples

Example 1

// with the default storage
import { ensureDir } from "@ayonli/jsext/fs";

await ensureDir("/path/to/dir");

Example 2

// with a user-selected directory as root (Chromium only)
import { ensureDir } from "@ayonli/jsext/fs";

const root = await window.showDirectoryPicker();
await ensureDir("/path/to/dir", { root });

Parameters

path: string
optional
options: Omit<MkdirOptions, "recursive"> = [UNSUPPORTED]

Returns

Promise<void>