# upath2

> A proxy to `path`, replacing `\` with `/` for all results

Latest version **3.1.25** (published 2026-08-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install upath2
pnpm add upath2
yarn add upath2
bun add upath2
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 3.1.25 |
| Published | 2026-08-14 |
| First published | 2016-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 52.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | bluelovers |
| Maintainers | bluelovers |
| Keywords | absolute, backslash, check, core, detect, dir, file, filepath, fix, forward, fp, fs, is, is-absolute, isabsolute, normalize, path, paths, sep, shim, slash, slashes, trailing, unix, urix, util, utils, win32, windows |

## Links

- npm: https://www.npmjs.com/package/upath2
- Repository: https://github.com/bluelovers/ws-iconv
- Homepage: https://github.com/bluelovers/ws-iconv/tree/master/packages/upath2#readme
- Issues: https://github.com/bluelovers/ws-iconv/issues
- npm.io page: https://npm.io/package/upath2

## Dependencies (5)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [@types/node](https://npm.io/package/@types/node.md) *
- [path-strip-sep](https://npm.io/package/path-strip-sep.md) ^1.0.21
- [@lazy-node/types-path](https://npm.io/package/@lazy-node/types-path.md) ^1.0.3
- [path-is-network-drive](https://npm.io/package/path-is-network-drive.md) ^1.0.24

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 3.1.25 (latest) — 2026-08-14
- 3.1.23 — 2026-03-02
- 3.1.22 — 2026-03-01
- 3.1.20 — 2024-08-29
- 3.1.19 — 2022-10-02
- 3.1.18 — 2022-09-29
- 3.1.16 — 2022-09-28
- 3.1.15 — 2022-08-11
- 3.1.13 — 2022-05-11
- 3.1.12 — 2021-12-29
- 3.1.11 — 2021-12-29
- 3.1.10 — 2021-08-13
- 3.1.9 — 2021-07-08
- 3.1.8 — 2021-06-16
- 3.1.7 — 2021-02-12
- … 15 more at https://npm.io/package/upath2/versions

## README

# upath2 - 跨平台路徑處理工具

![](https://david-dm.org/bluelovers/node-upath2.svg)

> 一個 `path` 的代理，將所有結果中的反斜線 (`\`) 替換為正斜線 (`/`)，從而實現跨平台的路徑處理。

## 主要功能

- 跨平台路徑處理
- 自動替換反斜線為正斜線
- 完全相容於 Node.js path 模組
- 支援 Windows 和 POSIX 平台
- 內建網路磁碟機路徑處理

## 安裝

```bash
npm install upath2
```

## 快速開始

## 使用方式

### 匯入模組

```ts
import * as upath from 'upath2';
```

### 基本使用

```ts
// 原來使用 path
import * as path from 'path';

// 改用 upath2
import * as upath from 'upath2';
```

upath2 完全相容於 Node.js path 模組的 API，可以無縫替換。

### 跨平台路徑處理

```ts
// Windows 路徑
const winPath = upath.join('C:\\Users\\User\\Documents', 'file.txt');
console.log(winPath); // 'C:/Users/User/Documents/file.txt'

// POSIX 路徑
const posixPath = upath.join('/home/user', 'documents', 'file.txt');
console.log(posixPath); // '/home/user/documents/file.txt'
```

---
_Source: https://npm.io/package/upath2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
