Skip to content
File systemReference

getfilesize

Get the size of a workspace file in bytes.

Details#

Get the size of a workspace file in bytes. File size in bytes as a Luau number. Missing files, folders and open/stat failures cause an error.

Signature#

Luau
getfilesize(path: string): number

Parameters#

ParameterTypeDescription
pathstringUTF-8 path relative to the application's workspace.

Returns#

File size in bytes as a Luau number. Missing files, folders and open/stat failures cause an error.

Examples#

Local example

Luau
writefile("docs-example/size.txt", "hello")
print(getfilesize("docs-example/size.txt")) -- 5