upath2

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

upath2 downloads upath2 version upath2 license

upath2类似的npm包:

npm下载趋势

3 年
🌟 在 upath2 的 README.md 中显示实时使用量图表,只需复制下面的代码。
## Usage Trend
[![Usage Trend of upath2](https://npm-compare.com/img/npm-trend/THREE_YEARS/upath2.png)](https://npm-compare.com/upath2#timeRange=THREE_YEARS)

Cumulative GitHub Star Trend

🌟 在 upath2 的 README.md 中显示 GitHub stars 趋势图表,只需复制下面的代码。
## GitHub Stars Trend
[![GitHub Stars Trend of upath2](https://npm-compare.com/img/github-trend/upath2.png)](https://npm-compare.com/upath2)

统计详情

npm包名称
下载量
Stars
大小
Issues
发布时间
License
upath279,172254 kB115 天前ISC

upath2的README

upath2 - 跨平台路徑處理工具

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

主要功能

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

安裝

npm install upath2

快速開始

使用方式

匯入模組

import * as upath from 'upath2';

基本使用

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

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

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

跨平台路徑處理

// 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'