Skip to main content
Version: nightly

Types

Url

Create a URL:

-- regular file
local url = Url("/root/Downloads/logo.png")

-- `bgm.mp3` from the archive `ost.zip`
local url = Url("archive:///root/ost.zip#bgm.mp3")

name

Filename of the URL.

Typestring?

stem

Filename without the extension.

Typestring?

parent

Parent directory.

TypeSelf?

is_regular

Whether the file represented by the URL is a regular file.

Typeboolean

Whether the file represented by the URL is from a search result.

Typeboolean

is_archive

Whether the file represented by the URL is from an archive.

Typeboolean

is_absolute

Whether the path represented by the URL is absolute.

Typeboolean

has_root

Whether the path represented by the URL has a root.

Typeboolean

join(self, other)

Join with other to create a new URL.

In/OutType
selfSelf
otherSelf | string
ReturnSelf

starts_with(self, base)

Whether the URL starts with base.

In/OutType
selfSelf
baseSelf | string
Returnboolean

ends_with(self, base)

Whether the URL ends with base.

In/OutType
selfSelf
baseSelf | string
Returnboolean

strip_prefix(self, base)

Strips the prefix of base.

In/OutType
selfSelf
baseSelf | string
ReturnPath

__eq(self, other)

Whether the URL is equal to other.

In/OutType
selfSelf
otherSelf
Returnboolean

__tostring(self)

Convert the URL to string.

In/OutType
selfSelf
Returnstring

__concat(self, other)

Concatenate the URL with other.

In/OutType
selfSelf
otherstring
ReturnSelf

__new(value)

Make a new URL.

In/OutType
valuestring | Self
ReturnSelf

Path

Path is the path portion of a Url.

For the URL sftp://my-server//path/to/file, the path is /path/to/file.

name

Filename of the path.

Typestring?

stem

Filename without the extension.

Typestring?

parent

Parent directory.

TypeSelf?

is_absolute

Whether the path is absolute.

Typeboolean

has_root

Whether the path has a root.

Typeboolean

join(self, other)

Join with other to create a new path.

In/OutType
selfSelf
otherSelf | string
ReturnSelf

starts_with(self, base)

Whether the path starts with base.

In/OutType
selfSelf
baseSelf | string
Returnboolean

ends_with(self, base)

Whether the path ends with base.

In/OutType
selfSelf
baseSelf | string
Returnboolean

strip_prefix(self, base)

Strips the prefix of base.

In/OutType
selfSelf
baseSelf | string
ReturnSelf

__eq(self, other)

Whether the path is equal to other.

In/OutType
selfSelf
otherSelf
Returnboolean

__tostring(self)

Convert the path to string.

In/OutType
selfSelf
Returnstring

__concat(self, other)

Concatenate the path with other.

In/OutType
selfSelf
otherstring
ReturnSelf

Cha

One file's characteristics.

is_dir

Whether the file is a directory.

Typeboolean

is_hidden

Whether the file is hidden.

Typeboolean

Whether the file is a symlink.

Typeboolean

is_orphan

Whether the file is a bad symlink, which points to a non-existent file.

Typeboolean

is_dummy

Whether the file is dummy, which fails to load complete metadata, possibly the filesystem doesn't support it, such as FUSE.

Typeboolean

is_block

Whether the file is a block device.

Typeboolean

is_char

Whether the file is a character device.

Typeboolean

is_fifo

Whether the file is a FIFO.

Typeboolean

is_sock

Whether the file is a socket.

Typeboolean

is_exec

Whether the file is executable.

Typeboolean

is_sticky

Whether the file has the sticky bit set.

Typeboolean

len

Length of the file in bytes.

If you want to get the size of a directory, use size() instead.

Typeinteger

atime

Accessed time of the file in Unix timestamp.

Typeinteger?

btime

Birth time of the file in Unix timestamp.

Typeinteger?

mtime

Modified time of the file in Unix timestamp.

Typeinteger?

uid

User id of the file.

Typeinteger?
AvailableUnix-like systems only

gid

Group id of the file.

Typeinteger?
AvailableUnix-like systems only

Number of hard links to the file.

Typeinteger?
AvailableUnix-like systems only

perm(self)

Unix permission representation, such as drwxr-xr-x.

Typestring?
AvailableUnix-like systems only

File

A bare file without any context information. See also fs::File.

url

URL of the file.

TypeUrl

cha

Cha of the file.

TypeCha

Path of the file points to, if it's a symlink.

TypePath?

name

Name of the file.

Typestring

Icon

An icon.

text

Text of the icon.

Typestring

style

Style of the icon.

TypeStyle

Error

An error.

code

Raw error code.

Typeinteger

__tostring(self)

Convert the error to string.

In/OutType
selfSelf
Returnstring

__concat(self, other)

Concatenate the error with other.

In/OutType
selfSelf
otherstring
ReturnError

Window

rows

Number of rows.

Typeinteger

cols

Number of columns.

Typeinteger

width

Width in pixels.

Typeinteger

height

Height in pixels.

Typeinteger