getFileExtension()function

getFileExtension(file: Nullish<string>): string | undefined
ParamType
fileNullish<string>
The filename to read the extension from, or a nullish value. required
Return
string | undefined
The extension (no leading dot), or undefined if the input has no extension.

Get the file extension from a file path, e.g. "md", or return undefined if the input has no extension.

Examples

getFileExtension("readme.md") // "md"