# @nextcloud/paths

> Helper functions for working with paths in Nextcloud apps

Latest version **3.1.0** (published 2026-02-18) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @nextcloud/paths
pnpm add @nextcloud/paths
yarn add @nextcloud/paths
bun add @nextcloud/paths
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2026-02-18 |
| First published | 2019-10-02 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | none |
| Module format | ESM |
| Node | ^20.0.0 \|\| ^22.0.0 \|\| ^24.0.0 |
| Dependencies | 0 |
| Unpacked size | 51.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Author | Nextcloud GmbH and Nextcloud contributors |
| Maintainers | icewind1991, skjnldsv, christophwurst, juliushaertl, nickvergessen, artonge, gretadoci, mejo-, susnux |
| Keywords | nextcloud, paths |

## Links

- npm: https://www.npmjs.com/package/@nextcloud/paths
- Repository: https://github.com/nextcloud-libraries/nextcloud-paths
- Homepage: https://github.com/nextcloud-libraries/nextcloud-paths#readme
- Issues: https://github.com/nextcloud-libraries/nextcloud-paths/issues
- npm.io page: https://npm.io/package/@nextcloud/paths

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 3.1.0 (latest) — 2026-02-18
- 3.0.0 — 2025-12-16
- 2.4.0 — 2025-12-13
- 2.3.0 — 2025-11-12
- 2.2.2 — 2025-11-06
- 2.2.1 — 2024-07-25
- 2.2.0 — 2024-07-17
- 2.1.0 — 2021-09-28
- 2.0.0 — 2021-04-07
- 1.1.2 — 2020-04-06
- 1.1.1 — 2020-03-19
- 1.1.0 — 2020-01-08
- 1.0.0 — 2019-12-18
- 0.2.0 — 2019-10-03
- 0.1.0 — 2019-10-02

## README

<!--
  - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  - SPDX-License-Identifier: GPL-3.0-or-later
-->
# @nextcloud/paths

[![REUSE status](https://api.reuse.software/badge/github.com/nextcloud-libraries/nextcloud-paths)](https://api.reuse.software/info/github.com/nextcloud-libraries/nextcloud-paths)
[![npm](https://img.shields.io/npm/v/@nextcloud/paths.svg)](https://www.npmjs.com/package/@nextcloud/paths)
[![Documentation](https://img.shields.io/badge/Documentation-online-brightgreen)](https://nextcloud-libraries.github.io/nextcloud-paths/)

Path helpers for Nextcloud apps.

## Installation

```
npm i -S @nextcloud/paths
```

## Usage

```js
import { basename, dirname, extname, encodePath, isSamePath, join, normalize } from '@nextcloud/paths'

basename('/my/file.txt')
// -> 'file.txt'

basename('/my/file.txt', '.txt')
// -> 'file'

dirname('/my/file.txt')
// -> '/my'

extname('/my/file.txt')
// -> '.txt'

encodePath('/my/other file.txt')
// -> '/my/other%20file'

isSamePath('/my/file.txt', 'my/file.txt')
// -> true

join('/my', 'folder', 'file.txt')
// -> '/my/folder/file.txt'

normalize('a//b//../b')
// -> 'a/b'
```

---
_Source: https://npm.io/package/@nextcloud/paths · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
