Path helpers for Nextcloud apps.
npm i -S @nextcloud/paths
import { basename, dirname, extname, encodePath, isSamePath, join } 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'