Package Exports
- pathe
Readme
pathe
Normalized paths for Node.js
๐งช This package is still experimental and might not handle all cases. Please track issues.
โ Why
For historical reasons, windows followed MSDos and using backslash \\ for seperating paths rather than slash /. While modern versions of Windows as well as Node.js on Windows, support slash nowadays!
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 lots of trouble of different code behavior between Windows and Posix and it makes problems with different behaviors.
This package is a replacement based on built in path module and always ensures path are normalized with slash /.
Compared to popular upath, this package tries to privide identical exports of Node.js with normalization on all operations and written in modern ESM/Typescript (upath is written with coffeescript and is not supporting native esm exports).
๐ฟ Install
Install using npm or yarn:
npm i pathe
# or
yarn add patheImport:
// ESM / Typescript
import { resolve } from 'pathe'
// CommonJS
const { resolve } = require('pathe')