llm
Download
48 lines 1.4 KiBGroffModified 2026-09-01 raw
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Path.extension 3 2026-09-01 "Tomo man-pages"
.SH NAME
Path.extension \- get file extension
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Path.extension\ :\ func(path:\ Path,\ full:\ Bool\ =\ yes\ ->\ Text?)
.fi
.SH DESCRIPTION
Returns the file extension of the file at the specified path. Optionally returns the full extension.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
path	Path	The path of the file. 	-
full	Bool	Whether to return everything after the first \fB.\fR in the base name, or only the last part of the extension. 	yes
.TE
.SH RETURN
The file extension, not including the leading `.`, or `none` if there is no extension.

.SH NOTES
A name with no `.` in it has no extension, and gives `none` rather than an empty text. A leading `.` does not count, so a dotfile like `(./.git)` has no extension, and neither does a name ending in a `.`.

.SH ERRORS
Also returns `none` when the name is not valid UTF-8, a POSIX filename being an arbitrary sequence of bytes while `Text` holds Unicode.

.SH EXAMPLES
.EX
assert (./file.tar.gz).extension() == "tar.gz"
assert (./file.tar.gz).extension(full=no) == "gz"

# No "." in the name means no extension:
assert (/foo).extension() == none
assert (./.git).extension() == none
assert (./foo.).extension() == none
.EE
.SH SEE ALSO
.BR Tomo-Path (3)