Skip to content

Standard Libraries

Nubo ships with built-in standard library modules that can be imported with import ... from.

import time from "@std/time"
import system from "@std/system"
import random from "@std/random"

You can also import selected values from a standard library module.

import { Time, now } from "@std/time"
ModuleDescription
@std/net/telnetConnect to Telnet servers, write data, read lines with timeouts, and close connections.
@std/net/sshConnect to SSH servers, authenticate with password or key files, run commands, read/write shell data, and close sessions.
@std/net/serialOpen serial ports, write data, read data with timeouts, and close ports.
@std/osFilesystem paths, directories, file metadata, copy, move, remove, exists, and mkdir helpers.
@std/timeDates, times, parsing, formatting, and arithmetic.
@std/mathNumeric helpers such as absolute value, square root, powers, sine, and cosine.
@std/systemProcess control, system information, file descriptors, and filesystem helpers.
@std/logSimple leveled logging with debug, info, warn, error, and configurable log level.
@std/threadConcurrency helpers, spawned work, scheduler yielding, and portals.
@std/jsonJSON parsing and stringifying.
@std/processExternal command execution with captured stdout, stderr, and exit code.
@std/iterIterator helper structs such as Progress, End, and Iterator.
@std/randomRandom numbers, booleans, choices, and seeding.
@std/ioConsole input, file streams, reading, writing, file output, and encodings.
@std/sqlSQLite, MySQL, and PostgreSQL database access.
@std/componentHTML components, component context, children, attributes, and html values.
@std/httpHTTP client instances, request configuration, responses, headers, body reading, and JSON responses.
@std/hashHashing, bcrypt password hashes, bcrypt comparison, and Argon2 hashing.
@std/plugGo plugin loading and plugin action calls.

When documenting a function value type, Nubo uses -> for the return type.

let mapper: fn(int) -> string

When writing a function implementation, write the return type after the parameter list.

fn formatNumber(value: int) string {
return string(value)
}

For a function that does not return a value, use void.

fn logMessage(message: string) void {
println(message)
}

Anonymous functions should be used as values or arguments.

let worker = fn(name: string) void {
println("Hello", name)
}