@nextcloud/paths

[![Build Status](https://travis-ci.com/nextcloud/nextcloud-paths.svg?branch=master)](https://travis-ci.com/nextcloud/nextcloud-paths) [![npm](https://img.shields.io/npm/v/@nextcloud/paths.svg)](https://www.npmjs.com/package/@nextcloud/paths) [![Documentat

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@nextcloud/paths
552.1.0a year ago3 years agoMinified + gzip package size for @nextcloud/paths in KB

Readme

@nextcloud/paths
Build Status npm Documentation
Path helpers for Nextcloud apps.

Installation

npm i -S @nextcloud/paths

Usage

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

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