getfilesize Synchronous
Read a workspace file's size without loading its contents. Check it before reading a file that might be too large to handle comfortably.
Luau
getfilesize(path: string) -> numberParameters
| Parameter | Type | Description |
|---|---|---|
path | string | Workspace-relative path of the file. |
Returns
numberThe size in bytes.
Usage notes
The call raises if the path is not an existing file. Folders have no size here.
Example
Luau
writefile("size-example.txt", "12345")
print(getfilesize("size-example.txt")) -- 5
delfile("size-example.txt")