This release is 5 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


Downloads102,227/wk
•Published9 months ago (1.0.9)
Utilities for working with file system paths
// Copyright 2018-2025 the Deno authors. MIT license. import * as posix from "./posix/mod.ts"; import * as windows from "./windows/mod.ts"; import { assertEquals } from "jsr:@std/assert@^1.0.13"; Deno.test("windows.toNamespacedPath() returns the namespaced path", () => { { const path = "C:\\path\\to\\file.txt"; const namespacedPath = windows.toNamespacedPath(path); assertEquals(namespacedPath, "\\\\?\\C:\\path\\to\\file.txt"); } // The path starts with double backslashs { const path = "\\\\path\\to\\file.txt"; const namespacedPath = windows.toNamespacedPath(path); assertEquals(namespacedPath, "\\\\?\\UNC\\path\\to\\file.txt"); } // When the input is empty string { const path = ""; const namespacedPath = windows.toNamespacedPath(path); assertEquals(namespacedPath, ""); } }); Deno.test("posix.toNamespacedPath() return the input as is", () => { const path = "/path/to/file.txt"; const namespacedPath = posix.toNamespacedPath(path); assertEquals(namespacedPath, "/path/to/file.txt"); });