Skip to content

Path.mkdirSync() method

pathlib-ts > Path > mkdirSync

Create a directory synchronously with optional parents and existOk.

Signature:

mkdirSync(options?: {
parents?: boolean;
existOk?: boolean;
mode?: number;
}): void;

Parameter

Type

Description

options

{ parents?: boolean; existOk?: boolean; mode?: number; }

(Optional) POSIX-style creation options (parents, existOk, mode).

Returns:

void

Mirrors Path.mkdir() but executes synchronously.

Preparing output directories synchronously

import { Path } from "pathlib-ts";
const outDir = new Path("./dist/assets");
outDir.mkdirSync({ parents: true, existOk: true });