Function join

  • Joins a sequence of paths, then normalizes the resulting path.

    Parameters

    • Rest...paths: string[]

      Paths to be joined and normalized.

    Returns string

    The joined and normalized path.

    import { join } from "@std/path/join";
    import { assertEquals } from "@std/assert";

    if (Deno.build.os === "windows") {
    assertEquals(join("C:\\foo", "bar", "baz\\quux", "garply", ".."), "C:\\foo\\bar\\baz\\quux");
    } else {
    assertEquals(join("/foo", "bar", "baz/quux", "garply", ".."), "/foo/bar/baz/quux");
    }

    Note: If you are working with file URLs, use the new version of join from @std/path/unstable-join.