util.file.size

Shared

Retrieves the size of a specified file


Syntax

local size = util.file.size(
    path
)

Prefix the path with :resourcename to access files from another running resource.

  • Local path — resolves relative to the current resource's directory.
  • Cross-resource path — prefix with :resourcename to resolve relative to another running resource's directory.
  • Example:resource_a/files/images/test.png accesses files/images/test.png inside resource_a.

Parameters

TypeNameDescription
stringpathFile path for size computation

Returns

TypeNameDescription
int | boolsizeComputed file size on successful execution, false otherwise

Examples

Get the size of a file within the current resource
core.engine.print("info", "File size:", util.file.size("files/images/test.png"))
Get the size of a file from another running resource
core.engine.print("info", "File size:", util.file.size(":resource_a/files/images/test.png"))

On this page