Gathering detailed insights and metrics for patha
Gathering detailed insights and metrics for patha
Gathering detailed insights and metrics for patha
Gathering detailed insights and metrics for patha
@salesforce/lds-adapters-sales-pathassistant
Connect APIs for Path Assistant
patha-thala-movie-link-720p
<h1>Pathu Thala Movie Download Kuttymovies 720p Link</h1>
@pathappdev/react-table-bs3
Bootstrap 3 layout for @tanstack/react-table
@ajay-pathak/ui-components
This library is made to use components in dentalkart.
File paths library. All you need to work with paths. Tiny drop-in replacement for 'path'. Works in Node, Browser, and Deno.
npm install patha
Typescript
Module System
Node Version
NPM Version
72.5
Supply Chain
98
Quality
74.9
Maintenance
100
Vulnerability
88
License
TypeScript (85.22%)
JavaScript (14.78%)
Total Downloads
13,617
Last Day
62
Last Week
360
Last Month
856
Last Year
7,847
Apache-2.0 License
4 Stars
99 Commits
2 Watchers
9 Branches
1 Contributors
Updated on May 12, 2025
Minified
Minified + Gzipped
Latest Version
0.4.1
Package Id
patha@0.4.1
Unpacked Size
281.75 kB
Size
76.33 kB
File Count
77
NPM Version
8.15.0
Node Version
16.17.0
Cumulative downloads
Total Downloads
Last Day
-6.1%
62
Compared to previous day
Last Week
48.1%
360
Compared to previous week
Last Month
-30%
856
Compared to previous month
Last Year
167%
7,847
Compared to previous year
17
4
File paths library. All you need to work with paths. Tiny drop-in replacement for 'path'. Works in Node, Browser, and Deno.
1npm install --save patha
patha
is tiny and treeshakable.
Automatic (depends on your build system)
1import * as patha from "patha"
Node
1import * as patha from "patha/dist/index.node.mjs"
Node CJS
1const patha = require("patha/dist/index.node.cjs")
Browser
1import * as patha from "patha/dist/index.browser.mjs"
Browser Legacy
1import * as patha from "patha/dist/index.browser.legacy.js"
Deno
1import * as patha from "patha/dist/index.deno.mjs"
patha
is a drop-replacement for path
, which is explained in the Nodejs documentation.
1import { 2 basename, 3 delimiter, 4 dirname, 5 extname, 6 format, 7 isAbsolute, 8 join, 9 normalize, 10 parse, 11 posix, 12 relative, 13 resolve, 14 sep, 15 toNamespacedPath, 16 win32, 17} from "patha"
Additionally, patha
supports the following functions:
addExeExt
(function)Add bin extension to the given binary name.
Parameters:
string
) - The name you want to add the shell extension tostring
) - Defaults to .exe
on Windowsstring
) - Defaults to ""
On other platforms.returns: string
1import { addExeExt } from "patha" 2 3addExeExt("path/to/file-name") // gives "path/to/file-name.exe" on Windows and "path/to/file-name" on others
addNamePrefix
(function)Adds a prefix to the start of the name of the given path
Parameters:
string
) - The given file pathstring
) - The prefix to add to the start of the file namereturns: string
1import { addNamePrefix } from "patha" 2 3addNamePrefix("path/to/file-name.ext", "new-") // gives "path/to/new-file-name.ext"
addNameSuffix
(function)Adds a suffix to the end of the name of the given path
Parameters:
string
) - The given file pathstring
) - The suffix to add to the end of the file namereturns: string
1import { addNameSuffix } from "patha" 2 3addNameSuffix("path/to/file-name.ext", "-old") // gives "path/to/file-name-old.ext" 4 5addNameSuffix("path/to/file-name.ext", ".test") // gives "path/to/file-name.test.ext"
addShExt
(function)Add a native shell extension to the given name.
Parameters:
string
) - The name you want to add the shell extension tostring
) - .cmd
on Windowsstring
) - .sh
On others.returns: string
1import { addShExt } from "patha" 2 3addShExt("path/to/file-name") // gives "path/to/file-name.cmd" on Windows and "path/to/file-name.sh" on others 4 5addShExt("path/to/file-name", ".bat") // gives "path/to/file-name.bat" on Windows and "path/to/file-name.sh" on others
addShRelativePrefix
(function)Prefix a ./
for unix shell and nothing for cmd
.
Parameters:
string
) - The given pathreturns: string
1import { addShRelativePrefix } from "patha" 2 3addShRelativePrefix("some/file-name") // gives "some/file-name" on Windows and "./some/file-name" on others.
name
(function)Get the name of the given file path.
By default the file extension is included in the returned name. To remove the extension, set the second parameter to false
.
Parameters:
string
) - The given file pathboolean
) - If the name should include the file extension as wellreturns: string
1import { name } from "patha" 2 3name("path/to/file.md") // gives "file.md" 4 5name("path/to/file.md", false) // gives "file"
normalizeTrim
(function)Normalizes the path and removes the trailing slashes.
Parameters:
string
) - The given file pathreturns: string
1import { normalize, normalizeTrim } from "patha" 2 3normalizeTrim("/foo/bar//baz/asdf/hello/../") // gives "/foo/bar/baz/asdf" 4 5normalize("/foo/bar//baz/asdf/hello/../") // gives "/foo/bar/baz/asdf/"
removeExt
(function)Remove a path's extension.
Parameters:
string
) - The given pathreturns: string
1import { removeExt } from "patha" 2 3removeExt("some/dir/file.ext") // gives "some/dir/file"
replaceExt
(function)Replaces the extension from path with extension and returns the updated path string.
Does not replace the extension if path is not a string or is empty.
Parameters:
string
) - The given pathstring
) - The extension to replacereturns: any
1import { replaceExt } from "patha" 2 3replaceExt("path/to/file.md", ".html") // gives "path/to/file.html"
isPathInside
(function)Check if a path is inside another path.
Note that relative paths are resolved against process.cwd()
to make them absolute.
This function does not check if the paths exist and it only works with strings.
Parameters:
string
)string
)returns: boolean
1import { isPathInside } from "patha" 2 3isPathInside("a/b/c", "a/b") 4//=> true 5 6isPathInside("a/b/c", "x/y") 7//=> false 8 9isPathInside("a/b/c", "a/b/c") 10//=> false 11 12isPathInside("/Users/some/dev/aa", "/Users/some") 13//=> true
You can sponsor my work here:
https://github.com/sponsors/aminya
Pull requests, issues and feature requests are welcome. See the Contributing guide.
No vulnerabilities found.
No security vulnerabilities found.