upath2
A proxy to `path`, replacing `\` with `/` for all results
Last updated a month ago by bluelovers .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install upath2 
SYNC missed versions from official npm registry.

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'

Current Tags

  • 3.1.23                                ...           latest (a month ago)

29 Versions

  • 3.1.23                                ...           a month ago
  • 3.1.22                                ...           a month ago
  • 3.1.20                                ...           2 years ago
  • 3.1.19                                ...           4 years ago
  • 3.1.18                                ...           4 years ago
  • 3.1.16                                ...           4 years ago
  • 3.1.15                                ...           4 years ago
  • 3.1.13                                ...           4 years ago
  • 3.1.12                                ...           4 years ago
  • 3.1.11                                ...           4 years ago
  • 3.1.10                                ...           5 years ago
  • 3.1.9                                ...           5 years ago
  • 3.1.8                                ...           5 years ago
  • 3.1.7                                ...           5 years ago
  • 3.1.6                                ...           6 years ago
  • 3.1.5                                ...           6 years ago
  • 3.1.4                                ...           6 years ago
  • 3.1.3                                ...           6 years ago
  • 3.0.6                                ...           6 years ago
  • 3.0.5                                ...           6 years ago
  • 3.0.4                                ...           6 years ago
  • 3.0.2                                ...           6 years ago
  • 2.1.3                                ...           7 years ago
  • 2.1.2                                ...           8 years ago
  • 2.1.0                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 29
Last Month 29
Dependencies (5)
Dev Dependencies (1)

Copyright 2013 - present © cnpmjs.org | Home |