upath
- Version 3.0.6
- Published
- 65 kB
- No dependencies
- MIT license
Install
npm i upathyarn add upathpnpm add upathOverview
A drop-in replacement / proxy to Node.js path, replacing \\ with / for all results & adding file extension functions.
Index
Variables
Functions
Interfaces
Variables
variable _default
const _default: UPath;variable delimiter
const delimiter: string;variable matchesGlob
const matchesGlob: (p: string, pattern: string) => boolean;variable posix
const posix: path.PlatformPath;variable sep
const sep: string;variable VERSION
const VERSION: string;variable win32
const win32: path.PlatformPath;Functions
function addExt
addExt: (file: string, ext: string) => string;Add an extension to
fileif it doesn't already end with it.
function basename
basename: (p: string, suffix?: string) => string;function changeExt
changeExt: ( filename: string, ext: string, ignoreExts?: string[], maxSize?: number) => string;Change the extension of
filename. The old extension is trimmed first (subject toignoreExts/maxSize), thenextis appended.
function defaultExt
defaultExt: ( filename: string, ext: string, ignoreExts?: string[], maxSize?: number) => string;Add
exttofilenameonly when it doesn't already have a valid extension (not inignoreExtsand not longer thanmaxSize).
function dirname
dirname: (p: string) => string;function extname
extname: (p: string) => string;function format
format: (pathObject: path.FormatInputPathObject) => string;function isAbsolute
isAbsolute: (p: string) => boolean;function join
join: (...paths: string[]) => string;function joinSafe
joinSafe: (...segments: string[]) => string;Like
path.joinbut preserves a leading./from the first segment and preserves UNC//or `//./' prefixes.
function normalize
normalize: (p: string) => string;function normalizeSafe
normalizeSafe: (p: string) => string;Normalize a path, preserving a leading
./if the original had one, and preserving UNC//or `//./' prefixes.
function normalizeTrim
normalizeTrim: (p: string) => string;Like
normalizeSafebut also trims a trailing slash (unless the path is root/).
function parse
parse: (p: string) => path.ParsedPath;function relative
relative: (from: string, to: string) => string;function removeExt
removeExt: (filename: string, ext: string) => string;Remove a specific extension from
filename. If the file doesn't have that extension, return it unchanged.
function resolve
resolve: (...paths: string[]) => string;function toNamespacedPath
toNamespacedPath: (p: string) => string;function toUnix
toUnix: (p: string) => string;Convert all backslashes to forward slashes and collapse duplicate slashes (except a leading double-slash for UNC paths).
function trimExt
trimExt: (filename: string, ignoreExts?: string[], maxSize?: number) => string;Trim the extension from
filenameif it's a valid extension (not inignoreExtsand not longer thanmaxSize).
Interfaces
interface UPath
interface UPath extends path.PlatformPath {}property sep
sep: '/';property VERSION
VERSION: string;method addExt
addExt: (file: string, ext: string) => string;method changeExt
changeExt: ( filename: string, ext: string, ignoreExts?: string[], maxSize?: number) => string;method defaultExt
defaultExt: ( filename: string, ext: string, ignoreExts?: string[], maxSize?: number) => string;method joinSafe
joinSafe: (...paths: string[]) => string;method normalizeSafe
normalizeSafe: (p: string) => string;method normalizeTrim
normalizeTrim: (p: string) => string;method removeExt
removeExt: (filename: string, ext: string) => string;method toUnix
toUnix: (p: string) => string;method trimExt
trimExt: (filename: string, ignoreExts?: string[], maxSize?: number) => string;Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (10)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/upath.
- Markdown[](https://www.jsdocs.io/package/upath)
- HTML<a href="https://www.jsdocs.io/package/upath"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3279 ms. - Missing or incorrect documentation? Open an issue for this package.
