{"id":16117972,"url":"https://github.com/wessberg/crosspath","last_synced_at":"2025-06-22T22:04:33.344Z","repository":{"id":60775030,"uuid":"371073382","full_name":"wessberg/crosspath","owner":"wessberg","description":"A wrapper around the path module that always normalizes to POSIX (including converting backslashes to forward slashes)","archived":false,"fork":false,"pushed_at":"2022-05-30T11:48:25.000Z","size":421,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-27T07:18:19.131Z","etag":null,"topics":["cross-platform","module","node","normalize","path","util"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wessberg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"wessberg","patreon":"wessberg"}},"created_at":"2021-05-26T14:58:48.000Z","updated_at":"2025-01-29T04:34:57.000Z","dependencies_parsed_at":"2022-10-04T16:16:32.691Z","dependency_job_id":null,"html_url":"https://github.com/wessberg/crosspath","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/wessberg/crosspath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wessberg%2Fcrosspath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wessberg%2Fcrosspath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wessberg%2Fcrosspath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wessberg%2Fcrosspath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wessberg","download_url":"https://codeload.github.com/wessberg/crosspath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wessberg%2Fcrosspath/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261374407,"owners_count":23148975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-platform","module","node","normalize","path","util"],"created_at":"2024-10-09T20:48:06.382Z","updated_at":"2025-06-22T22:04:28.327Z","avatar_url":"https://github.com/wessberg.png","language":"TypeScript","readme":"\u003c!-- SHADOW_SECTION_LOGO_START --\u003e\n\n\u003cdiv\u003e\u003cimg alt=\"Logo\" src=\"https://raw.githubusercontent.com/wessberg/crosspath/master/documentation/asset/logo.png\" height=\"80\"   /\u003e\u003c/div\u003e\n\n\u003c!-- SHADOW_SECTION_LOGO_END --\u003e\n\n\u003c!-- SHADOW_SECTION_DESCRIPTION_SHORT_START --\u003e\n\n\u003e A wrapper around the path module that always normalizes to POSIX (including converting backslashes to forward slashes)\n\n\u003c!-- SHADOW_SECTION_DESCRIPTION_SHORT_END --\u003e\n\n\u003c!-- SHADOW_SECTION_BADGES_START --\u003e\n\n\u003ca href=\"https://npmcharts.com/compare/crosspath?minimal=true\"\u003e\u003cimg alt=\"Downloads per month\" src=\"https://img.shields.io/npm/dm/crosspath.svg\"    /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/crosspath\"\u003e\u003cimg alt=\"NPM version\" src=\"https://badge.fury.io/js/crosspath.svg\"    /\u003e\u003c/a\u003e\n\u003cimg alt=\"Dependencies\" src=\"https://img.shields.io/librariesio/github/wessberg%2Fcrosspath.svg\"    /\u003e\n\u003ca href=\"https://github.com/wessberg/crosspath/graphs/contributors\"\u003e\u003cimg alt=\"Contributors\" src=\"https://img.shields.io/github/contributors/wessberg%2Fcrosspath.svg\"    /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/prettier/prettier\"\u003e\u003cimg alt=\"code style: prettier\" src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg\"    /\u003e\u003c/a\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\"    /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.patreon.com/bePatron?u=11315442\"\u003e\u003cimg alt=\"Support on Patreon\" src=\"https://img.shields.io/badge/patreon-donate-green.svg\"    /\u003e\u003c/a\u003e\n\n\u003c!-- SHADOW_SECTION_BADGES_END --\u003e\n\n\u003c!-- SHADOW_SECTION_DESCRIPTION_LONG_START --\u003e\n\n## Description\n\n\u003c!-- SHADOW_SECTION_DESCRIPTION_LONG_END --\u003e\n\nThe built-in [`path` module](https://nodejs.org/api/path.html) in Node.js provides utilities for working with file and directory paths in Node.js. The default operation\nof it varies [based on the operating system](https://nodejs.org/api/path.html#path_windows_vs_posix) on which Node.js is running.\n\nWhile this is generally a good thing, there are situations where you might want to normalize paths such that they always follow POSIX formatting.\nWhile the `path` module _does_ export POSIX specific implementations via the [`path.posix`](https://nodejs.org/api/path.html#path_path_posix) property,\nit is not really sufficient, as it doesn't convert windows-style paths with backslashes into forward slashes.\n\n`crosspath` is a drop-in replacement for `path` that wraps it to ensure that paths are always POSIX-formatted, including on Windows.\nYou can still access the underlying implementations via the `native` property, which is useful when you do need to convert back into OS-specific\npaths, for example when writing to the file system\n\n\u003c!-- SHADOW_SECTION_FEATURES_START --\u003e\n\n### Features\n\n\u003c!-- SHADOW_SECTION_FEATURES_END --\u003e\n\n- A drop-in replacement\n- Tiny as it relies on the implementations of the underlying path module\n\n\u003c!-- SHADOW_SECTION_FEATURE_IMAGE_START --\u003e\n\n\u003c!-- SHADOW_SECTION_FEATURE_IMAGE_END --\u003e\n\n\u003c!-- SHADOW_SECTION_BACKERS_START --\u003e\n\n## Backers\n\n| \u003ca href=\"https://usebubbles.com\"\u003e\u003cimg alt=\"Bubbles\" src=\"https://uploads-ssl.webflow.com/5d682047c28b217055606673/5e5360be16879c1d0dca6514_icon-thin-128x128%402x.png\" height=\"70\"   /\u003e\u003c/a\u003e | \u003ca href=\"https://github.com/cblanc\"\u003e\u003cimg alt=\"Christopher Blanchard\" src=\"https://avatars0.githubusercontent.com/u/2160685?s=400\u0026v=4\" height=\"70\"   /\u003e\u003c/a\u003e | \u003ca href=\"https://github.com/ideal-postcodes\"\u003e\u003cimg alt=\"Ideal Postcodes\" src=\"https://avatars.githubusercontent.com/u/4996310?s=200\u0026v=4\" height=\"70\"   /\u003e\u003c/a\u003e | \u003ca href=\"https://www.xerox.com\"\u003e\u003cimg alt=\"Xerox\" src=\"https://avatars.githubusercontent.com/u/9158512?s=200\u0026v=4\" height=\"70\"   /\u003e\u003c/a\u003e | \u003ca href=\"https://changelog.me\"\u003e\u003cimg alt=\"Trent Raymond\" src=\"https://avatars.githubusercontent.com/u/1509616?v=4\" height=\"70\"   /\u003e\u003c/a\u003e | \u003ca href=\"https://scrubtheweb.com\"\u003e\u003cimg alt=\"scrubtheweb\" src=\"https://avatars.githubusercontent.com/u/41668218?v=4\" height=\"70\"   /\u003e\u003c/a\u003e |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [Bubbles](https://usebubbles.com)\u003cbr\u003e\u003cstrong\u003eTwitter\u003c/strong\u003e: [@usebubbles](https://twitter.com/usebubbles)                                                                                | [Christopher Blanchard](https://github.com/cblanc)                                                                                                         | [Ideal Postcodes](https://github.com/ideal-postcodes)                                                                                                        | [Xerox](https://www.xerox.com)                                                                                                        | [Trent Raymond](https://changelog.me)                                                                                                  | [scrubtheweb](https://scrubtheweb.com)                                                                                                   |\n\n### Patreon\n\n\u003ca href=\"https://www.patreon.com/bePatron?u=11315442\"\u003e\u003cimg alt=\"Patrons on Patreon\" src=\"https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dwessberg%26type%3Dpatrons\"  width=\"200\"  /\u003e\u003c/a\u003e\n\n\u003c!-- SHADOW_SECTION_BACKERS_END --\u003e\n\n\u003c!-- SHADOW_SECTION_TOC_START --\u003e\n\n## Table of Contents\n\n- [Description](#description)\n  - [Features](#features)\n- [Backers](#backers)\n  - [Patreon](#patreon)\n- [Table of Contents](#table-of-contents)\n- [Install](#install)\n  - [npm](#npm)\n  - [Yarn](#yarn)\n  - [pnpm](#pnpm)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [Maintainers](#maintainers)\n- [FAQ](#faq)\n  - [Why not simply use `path.posix` always? Isn't this library redundant?](#why-not-simply-use-pathposix-always-isnt-this-library-redundant)\n- [License](#license)\n\n\u003c!-- SHADOW_SECTION_TOC_END --\u003e\n\n\u003c!-- SHADOW_SECTION_INSTALL_START --\u003e\n\n## Install\n\n### npm\n\n```\n$ npm install crosspath\n```\n\n### Yarn\n\n```\n$ yarn add crosspath\n```\n\n### pnpm\n\n```\n$ pnpm add crosspath\n```\n\n\u003c!-- SHADOW_SECTION_INSTALL_END --\u003e\n\n\u003c!-- SHADOW_SECTION_USAGE_START --\u003e\n\n## Usage\n\n\u003c!-- SHADOW_SECTION_USAGE_END --\u003e\n\nSimply import what you need, exactly as you would with the `path` module:\n\n```ts\n// Import just what you need:\nimport {join, relative} from \"crosspath\";\n\n// or simply:\nimport path from \"crosspath\";\n\n// Becomes 'C:/foo/bar'\npath.join(\"C:\\\\foo\", \"\\\\bar\");\n\n// Becomes '../bar'\npath.relative(\"C:\\\\foo\", \"C:\\\\bar\");\n```\n\nIf you want to use the native path helpers and constants without the POSIX normalization, these are all accessible\nvia the `path.native` property:\n\n```ts\nimport path from \"crosspath\";\n\n// Becomes 'C:\\foo\\bar' on Windows and C:\\foo/\\bar on POSIX-systems\npath.native.join(\"C:\\\\foo\", \"\\\\bar\");\n\n// Becomes '..\\bar' on Windows and ../C:\\bar on POSIX-systems\npath.native.relative(\"C:\\\\foo\", \"C:\\\\bar\");\n```\n\nThis can be useful when you _do_ want the paths to respect the OS convention, such as when you interact with the file system.\n\n\u003c!-- SHADOW_SECTION_CONTRIBUTING_START --\u003e\n\n## Contributing\n\nDo you want to contribute? Awesome! Please follow [these recommendations](./CONTRIBUTING.md).\n\n\u003c!-- SHADOW_SECTION_CONTRIBUTING_END --\u003e\n\n\u003c!-- SHADOW_SECTION_MAINTAINERS_START --\u003e\n\n## Maintainers\n\n| \u003ca href=\"mailto:frederikwessberg@hotmail.com\"\u003e\u003cimg alt=\"Frederik Wessberg\" src=\"https://avatars2.githubusercontent.com/u/20454213?s=460\u0026v=4\" height=\"70\"   /\u003e\u003c/a\u003e                                                                |\n| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [Frederik Wessberg](mailto:frederikwessberg@hotmail.com)\u003cbr\u003e\u003cstrong\u003eTwitter\u003c/strong\u003e: [@FredWessberg](https://twitter.com/FredWessberg)\u003cbr\u003e\u003cstrong\u003eGithub\u003c/strong\u003e: [@wessberg](https://github.com/wessberg)\u003cbr\u003e_Lead Developer_ |\n\n\u003c!-- SHADOW_SECTION_MAINTAINERS_END --\u003e\n\n\u003c!-- SHADOW_SECTION_FAQ_START --\u003e\n\n## FAQ\n\n\u003c!-- SHADOW_SECTION_FAQ_END --\u003e\n\n### Why not simply use `path.posix` always? Isn't this library redundant?\n\nNo, not quite (but close). While it is true that `path.posix` can be used from Windows, it has the fundamental\nshortcoming that it [doesn't convert backslashes into forward slashes](https://nodejs.org/api/path.html#path_path_normalize_path).\nThis is not a mistake, but rather a design decision. This library makes another decision and unifies the behavior between\nthe two approaches to make it easier to build cross-platform libraries and tools.\n\n\u003c!-- SHADOW_SECTION_LICENSE_START --\u003e\n\n## License\n\nMIT © [Frederik Wessberg](mailto:frederikwessberg@hotmail.com) ([@FredWessberg](https://twitter.com/FredWessberg)) ([Website](https://github.com/wessberg))\n\n\u003c!-- SHADOW_SECTION_LICENSE_END --\u003e\n","funding_links":["https://github.com/sponsors/wessberg","https://patreon.com/wessberg","https://www.patreon.com/bePatron?u=11315442"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwessberg%2Fcrosspath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwessberg%2Fcrosspath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwessberg%2Fcrosspath/lists"}