Built-in Modules
Reference guide for ZSM's high-level built-in functions.
ZSM provides several built-in modules that simplify script logic and reduce dependencies on external binaries. All built-ins are subject to the same permission system as external tools.
fs (Filesystem)
Requires: # :: perm fs
fs.move(src, dest)
Moves a file or directory. Handles cross-device moves automatically.
fs.move("/tmp/app", "~/.local/bin/app")fs.mkdir(path)
Recursively creates directories (equivalent to mkdir -p).
fs.mkdir("~/.config/myapp")fs.chmod(path, mode)
Changes file permissions using octal notation.
fs.chmod("~/.local/bin/app", "755")web (Networking)
Requires: # :: perm net
web.download(url, dest)
Downloads a file to the specified destination. Uses a supervised curl call internally.
web.download("https://example.com/bin.tar.gz", "/tmp/bin.tar.gz")web.get_json_field(url, field)
Fetches a JSON object and extracts a specific string field. Useful for release tags.
LATEST = web.get_json_field("https://api.github.com/...", "tag_name")system (Host Info)
system.os()
Returns the host operating system (e.g. linux, macos).
system.arch()
Returns the host architecture (e.g. x86_64, aarch64).
system.arch_mapped()
Returns a normalized architecture name (e.g. amd64 instead of x86_64).
echo (Global)
echo(message)
Prints a message to stdout. Flushes automatically.
echo("Installation started...")2026 © All Rights Reserved.
- All the content is available under CC BY-SA 4.0, expect where otherwise stated.
- Source code is available on GitLab, licensed under Apache 2.0.
Last updated on
