
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
Universal filesystem path utils
For historical reasons, windows followed MS-DOS and used backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, Windows supports both Slash and Backslash for paths. Node.js's built-in path module in the default operation of the path module varies based on the operating system on which a Node.js application is running. Specifically, when running on a Windows operating system, the path module will assume that Windows-style paths are being used. This makes inconsistent code behavior between Windows and POSIX.
Compared to popular upath, pathe provides identical exports of Node.js with normalization on all operations and is written in modern ESM/TypeScript and has no dependency on Node.js!
This package is a drop-in replacement of the Node.js's path module module and ensures paths are normalized with slash / and work in environments including Node.js.
Install using npm or yarn:
# npm
npm i pathe
# yarn
yarn add pathe
# pnpm
pnpm i pathe
Import:
// ESM / Typescript
import { resolve, matchesGlob } from "pathe";
// CommonJS
const { resolve, matchesGlob } = require("pathe");
Read more about path utils from Node.js documentation and rest assured behavior is consistently like POSIX regardless of your input paths format and running platform (the only exception is delimiter constant export, it will be set to ; on windows platform).
Pathe exports some extra utilities that do not exist in standard Node.js path module.
In order to use them, you can import from pathe/utils subpath:
import {
filename,
normalizeAliases,
resolveAlias,
reverseResolveAlias,
} from "pathe/utils";
Made with 💛 Published under the MIT license.
Some code was used from the Node.js project. Glob supported is powered by zeptomatch.
The 'path' module is a built-in Node.js module that provides utilities for working with file and directory paths. It offers similar functionalities to 'pathe' such as joining, resolving, normalizing paths, and extracting directory names, base names, and extensions. 'pathe' can be seen as an enhanced version of the 'path' module with additional features and improvements.
The 'upath' package is a utility for working with file paths across different operating systems. It ensures consistent path handling regardless of the platform. 'upath' offers similar functionalities to 'pathe' but focuses more on cross-platform compatibility.
The 'path-to-regexp' package is used to convert paths to regular expressions, which can be useful for routing and matching URL patterns. While it provides some path manipulation capabilities, its primary focus is on pattern matching, making it somewhat different from 'pathe'.
FAQs
Universal filesystem path utils
The npm package pathe receives a total of 72,271,054 weekly downloads. As such, pathe popularity was classified as popular.
We found that pathe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.