Skip to content

PersistentAI API Documentation / @persistentai/fireflow-vfs / path / getPathDepth

Function: getPathDepth()

getPathDepth(pathOrUri): number

Defined in: packages/fireflow-vfs/src/path/utils.ts:178

Get the depth of a path (number of segments).

Parameters

pathOrUri

string

Path or URI string

Returns

number

Number of segments

Example

ts
getPathDepth('/')           // 0
getPathDepth('/foo')        // 1
getPathDepth('/foo/bar')    // 2

Licensed under BUSL-1.1