Method Stdio.file_size()


Method file_size

int file_size(string filename, bool|void do_not_follow_symlinks)

Description

Give the size of a file.

Parameter filename

Path to file to check.

Parameter do_not_follow_symlinks

Set this to 1 to inhibit following of symlinks.

Returns

Returns one of:

(0..)

A non-negative value is the length (aka size) of the regular file.

-1

A size of -1 indicates that the file either does not exist, or that it is not readable by you.

-2

Size -2 indicates that it is a directory.

-3

-3 means that it is a symlink. Note that this is only returned for broken symlinks unless do_not_follow_symlinks is 1.

-4

filename is a device node.

See also

file_stat(), write_file(), read_bytes()