Skip to content
Get started

Get filesystem path info

client.instances.stat(stringid, InstanceStatParams { path_, follow_links } query, RequestOptionsoptions?): PathInfo { exists, error, is_dir, 5 more }
get/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.

ParametersExpand Collapse
id: string
query: InstanceStatParams { path_, follow_links }
path_: string

Path to stat in the guest filesystem

ReturnsExpand Collapse
PathInfo { exists, error, is_dir, 5 more }
exists: boolean

Whether the path exists

error?: string | null

Error message if stat failed (e.g., permission denied). Only set when exists is false due to an error rather than the path not existing.

is_dir?: boolean

True if this is a directory

is_file?: boolean

True if this is a regular file

mode?: number

File mode (Unix permissions)

size?: number

File size in bytes

formatint64
Get filesystem path info
import Hypeman from '@onkernel/hypeman';

const client = new Hypeman({
  apiKey: 'My API Key',
});

const pathInfo = await client.instances.stat('id', { path: 'path' });

console.log(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
}