ReferenceFilesystem

getfilesize

Returns the size of a workspace file.

Syntax

getfilesize(path: string) -> number

Parameters

ParameterTypeDescription
pathstringWorkspace-relative file.

Returns

TypeDescription
numberThe file's size in bytes.

Description

The file is read the way readfile reads it, so the same path rules and errors apply, and a missing file raises an error.

Example

writefile("size-example.txt", "hello")
print(getfilesize("size-example.txt"))
delfile("size-example.txt")

These are Game executor contracts. Check build requirements and session lifetimes before using them.