Path normalization helpers for build tools that turn file paths into URL paths.
urix is deprecated and its original API depended on the current operating system. This package keeps the migration-friendly urix(path) function, adds deterministic options for tests and cross-platform tooling, and exposes small helpers for explicit path normalization.
npm install url-pathsimport { toUrlPath, urix } from "url-paths";
urix("c:\\users\\you\\foo", { platform: "win32" });
// "/users/you/foo"
toUrlPath("\\server\\share\\asset.png", { platform: "win32" });
// "//server/share/asset.png"Migration-compatible alias for toUrlPath(path, options).
Converts Windows-style paths to URL-friendly slash-separated paths when platform is "win32". On POSIX platforms it preserves the old no-op behavior unless force is set.
Options:
platform: platform to emulate. Defaults toprocess.platform.force: normalize slashes even on non-Windows platforms.preserveDrive: keepC:instead of convertingC:\xto/x.
Replaces backslashes with slashes.
Converts leading Windows drive paths such as C:/users to /users.
url-paths is an independent alternative or migration helper for projects moving away from urix. It is not affiliated with the original package maintainers or project.
For release context, see the local migration guide, examples, compatibility notes, source metadata, and adoption plan.