io_stat
io_stat synchronously waits for dependencies, then returns information about a project-relative path. It follows symbolic links that remain inside the project root; links that escape the project root return an error. A missing path returns None instead of an error.
Existing paths return a struct with these fields:
| Field | Type | Description |
|---|---|---|
name | string | Base name of the path. |
size | int | File size in bytes. |
mode | int | Go file mode and permission bits. |
mod_time | int | Modification time as Unix seconds. |
is_dir | bool | Whether the path is a directory. |
Arguments
| Argument | Required | Description |
|---|---|---|
path | Yes | Project-relative path to inspect. |
deps | No | Dependencies to complete before inspecting the path. |
Example
load("@io@1", "io_stat")
info = io_stat("generated/output.txt")
if info != None:
print(info.size)