Get filesystem path info
client.Instances.Stat(ctx, id, query) (*PathInfo, error)
/instances/{id}/stat
Returns information about a path in the guest filesystem. Useful for checking if a path exists, its type, and permissions before performing file operations.
Parameters
id string
Returns
Get filesystem path info
package main
import (
"context"
"fmt"
"github.com/kernel/hypeman-go"
"github.com/kernel/hypeman-go/option"
)
func main() {
client := hypeman.NewClient(
option.WithAPIKey("My API Key"),
)
pathInfo, err := client.Instances.Stat(
context.TODO(),
"id",
hypeman.InstanceStatParams{
Path: "path",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", pathInfo.Exists)
}
{
"exists": true,
"error": "permission denied",
"is_dir": false,
"is_file": true,
"is_symlink": false,
"link_target": "/actual/target/path",
"mode": 420,
"size": 1024
}
Returns Examples
{
"exists": true,
"error": "permission denied",
"is_dir": false,
"is_file": true,
"is_symlink": false,
"link_target": "/actual/target/path",
"mode": 420,
"size": 1024
}