Skip to content

canonicalize ​

Resolves a path to an absolute, normalized path with all symlinks resolved. Throws FsError if the path does not exist.

Signaturecanonicalize(path: string): Result<string, FsError>

Example ​

tyrus
import { canonicalize, FsError } from "tyrus:fs";

match (canonicalize("./file.txt")) {
    Ok(path) => { print(path); } // /home/user/project/file.txt
    Err(error) => { printError(error.code); } // ERR_FS_CANONICALIZE_FAILED
}