This release is 13 versions behind 1.1.4 — the latest version of @std/path. Jump to latest
Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
Works with
•JSR Score94%•This package works with Cloudflare Workers, Deno, Browsers


Downloads119,430/wk
•Published2 years ago (1.0.1)
Utilities for working with file system paths
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. import { isWindows } from "./_os.ts"; import { join as posixJoin } from "./posix/join.ts"; import { join as windowsJoin } from "./windows/join.ts"; /** * Joins a sequence of paths, then normalizes the resulting path. * * @example Usage * ```ts * 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"); * } * ``` * * @param paths Paths to be joined and normalized. * @returns The joined and normalized path. */ export function join(...paths: string[]): string { return isWindows ? windowsJoin(...paths) : posixJoin(...paths); }