Skip to content

mkdir ​

Creates a new directory at the given path. The path is resolved transparently before reaching the operating system. It returns Err(FsError) if creation fails; inspect the result with match or propagate it with ?.

Signaturemkdir(path: string): Result<void, FsError>

Example ​

tyrus
import { mkdir, type FsError } from "tyrus:fs";

match (mkdir("subdir")) {
    Ok(_) => { print("directory created"); }
    Err(error) => { printError(error.code); // ERR_FS_MKDIR_FAILED
    }
}