Skip to content

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

Function: withExtension()

withExtension(pathOrUri, newExt): string

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

Change the extension of a path.

Parameters

pathOrUri

string

Original path

newExt

string

New extension (with or without dot)

Returns

string

Path with new extension

Example

ts
withExtension('/foo/bar.txt', '.md')  // '/foo/bar.md'
withExtension('/foo/bar.txt', 'md')   // '/foo/bar.md'

Licensed under BUSL-1.1