Skip to content

filename

Import from @varavel/vdl-plugin-sdk/utils/paths.

function filename(path): string | undefined;

Returns the filename without its extension.

This is useful for deriving stable artifact names without manually stripping directory segments or extensions.

Parameters

Parameter Type Description
path string Path to inspect.

Returns

string | undefined

The filename without its extension, or undefined when it cannot be derived.

Example

filename("generated/models/user.ts");
// returns "user"

See

Powered by pathe (MIT License): https://github.com/unjs/pathe