Skip to main content

@rtorcato/supabase-common / splitPath

Function: splitPath()

splitPath(path): object

Defined in: storage.ts:156

Split a storage path into { dir, name, ext } (a leading dot is a hidden file, not an extension; only the last . splits the extension).

splitPath('user-1/avatars/a.png') // → { dir: 'user-1/avatars', name: 'a', ext: 'png' } splitPath('.gitignore') // → { dir: '', name: '.gitignore', ext: '' }

Parameters​

path​

string

Returns​

object

dir​

dir: string

name​

name: string

ext​

ext: string