Skip to main content

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?

frag

Url fragment.

Let's say the url archive:///root/my-archive.zip#1.jpg, the fragment 1.jpg.

Typestring?

parent

Parent directory.

TypeUrl?

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, another)

Join with another.

In/OutType
selfUrl
anotherUrl | string
ReturnUrl

starts_with(self, another)

Whether the url starts with another.

In/OutType
selfUrl
anotherUrl | string
Returnboolean

ends_with(self, another)

Whether the url ends with another.

In/OutType
selfUrl
anotherUrl | string
Returnboolean

strip_prefix(self, another)

Strips the prefix of another.

In/OutType
selfUrl
anotherUrl | string
ReturnUrl

__eq(self, another)

Whether the url is equal to another.

In/OutType
selfUrl
anotherUrl
Returnboolean

__tostring(self)

Convert the url to string.

In/OutType
selfUrl
Returnstring

__concat(self, another)

Concatenate the url with another.

In/OutType
selfUrl
anotherstring
ReturnUrl

Cha

Cha means 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

url

Url of the file.

TypeUrl

cha

Cha of the file.

TypeCha

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

TypeUrl?

name

Name of the file.

Typestring

Icon

text

Text of the icon.

Typestring

style

Style of the icon.

TypeStyle

Error

code

Raw error code.

Typeinteger

__tostring(self)

Convert the error to string.

In/OutType
selfError
Returnstring

__concat(self, another)

Concatenate the error with another.

In/OutType
selfError
anotherstring
ReturnError

Window

rows

Number of rows.

Typeinteger

cols

Number of columns.

Typeinteger

width

Width in pixels.

Typeinteger

height

Height in pixels.

Typeinteger