https://github.com/nextcloud-libraries/nextcloud-paths
Path helpers for Nextcloud https://npmjs.org/@nextcloud/paths
https://github.com/nextcloud-libraries/nextcloud-paths
Last synced: about 1 year ago
JSON representation
Path helpers for Nextcloud https://npmjs.org/@nextcloud/paths
- Host: GitHub
- URL: https://github.com/nextcloud-libraries/nextcloud-paths
- Owner: nextcloud-libraries
- License: gpl-3.0
- Created: 2019-06-18T07:07:59.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2025-04-12T01:24:41.000Z (about 1 year ago)
- Last Synced: 2025-04-12T02:40:00.900Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://nextcloud-libraries.github.io/nextcloud-paths/
- Size: 3.31 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Authors: AUTHORS.md
Awesome Lists containing this project
README
# @nextcloud/paths
[](https://api.reuse.software/info/github.com/nextcloud-libraries/nextcloud-paths)
[](https://www.npmjs.com/package/@nextcloud/paths)
[](https://nextcloud-libraries.github.io/nextcloud-paths/)
Path helpers for Nextcloud apps.
## Installation
```
npm i -S @nextcloud/paths
```
## Usage
```js
import { basename, dirname, encodePath, isSamePath, joinPaths } from '@nextcloud/paths'
basename('/my/file.txt')
// -> 'file.txt'
dirname('/my/file.txt')
// -> '/my'
encodePath('/my/other file.txt')
// -> '/my/other%20file'
isSamePath('/my/file.txt', 'my/file.txt')
// -> true
joinPaths('/my', 'folder', 'file.txt')
// -> '/my/folder/file.txt'
```