Standard Library
Import modules with from "std/<name>" import { symbols }.
Most utilities are namespaced: call a static on the namespace (Path.join, Json.parse, Math.sqrt) or a method on the value (s.trim(), dt.format()).
I/O & Filesystem
| Module | What it provides |
|---|---|
std/io | readStdin, writeStdout, File.openRead/.openWrite/.openAppend, f.readAll(), f.writeAll(), RAII file handles |
std/fs | readFile, readLines, readDir, fileInfo, isDir/isFile, pathExists, writeFile |
std/path | Path.join, Path.basename, Path.dirname, Path.ext, Path.stem |
std/env | Env.get, Env.getOr |
Networking
| Module | What it provides |
|---|---|
std/net | TCP, DNS |
std/fetch | HTTP client: fetch, fetchWith, redirects, and the TLS client socket TlsStream |
std/tls | TLS server transport: TlsListener.bind, accept |
std/https | HTTPS server: serveTls, serveRouterTls |
std/ws | WebSocket client and server: wsAccept, wsConnect, WsConn |
std/wsframe | WebSocket wire format, no IO: computeAcceptKey, encodeWsFrame, parseWsFrame |
std/chunked | HTTP/1.1 chunked transfer coding, no IO: ChunkScan, decodeChunked |
std/unix | Unix-domain sockets: UnixListener, UnixStream |
std/http | HTTP server with Hono-style router, context, middleware |
std/httpmw | Optional HTTP middleware: gzip, verifyBearer |
std/webpush | Web Push: payload encryption (RFC 8291) and VAPID headers (RFC 8292): WebPush.encrypt, WebPush.vapid, VapidKeys |
std/html | HTML escaping — Html.escapeText, Html.escapeAttr, Html.isSafeUrl |
std/mime | Media types by extension — Mime.fromPath, Mime.contentType |
std/multipart | multipart/form-data parsing — Multipart.parse, Part.safeFilename |
Data
| Module | What it provides |
|---|---|
std/json | Zero-copy JSON parser: Json.parse, keyed accessors (.str(), .i64(), .f64(), .bool()). Serializing a struct is the built-in jsonStringify, no import |
std/arena | Generational arena for cyclic/graph data with safe Handle<T>; the how-to is Patterns |
std/set | HashSet<T> — s.add, s.contains, s.remove |
std/collections | BinaryHeap, Deque, SortedMap (B-tree), OrderedMap, Counter, bisectLeft/insertSorted |
std/cache | LruCache and TtlCache (per-entry expiry, optional LRU capacity) |
CLI & System
| Module | What it provides |
|---|---|
std/argparse | CLI argument parsing with typed getters and --help generation |
std/args | Raw CLI arguments — args(), getFlag, hasFlag |
std/process | Command execution, Process.spawn/.wait()/.signal(), run, capture |
std/signal | POSIX signal handling — onSignal, ignoreSignal |
std/term | Terminal raw mode and size: enableRawMode, terminalSize |
std/keys | Decode terminal input bytes into keys: decodeKey, KeyCode |
std/ansi | Cursor, screen and 256/24-bit color escapes: Ansi.cursorTo, Ansi.fg256 |
std/pty | Pseudoterminals: Pty.open, openAndSpawn |
std/sysinfo | Host and process info: hostname, cpuCount, totalMem, cwd |
std/environ | The whole environment: envVars |
std/os | Typed libc bindings the rest of std is built on |
std/dl | Load shared libraries at run time: dlOpen, Lib.sym |
Data Formats
| Module | What it provides |
|---|---|
std/csv | CSV parsing with header support — Csv.parse, Csv.stringify |
std/xml | Strict XML 1.0: a pull parser (XmlReader) and an owned tree (Xml.parse, XmlNode) |
std/base64 | Base64 encode/decode — Base64.encode, Base64.decode |
std/hex | Hex encode/decode — Hex.encode, Hex.decode |
std/binary | Fixed-width int/float codecs — Bytes.readU32Le, Bytes.writeI16Be, both byte orders |
std/png | PNG encode/decode: Png.encode, Png.decode |
std/jpeg | JPEG encode/decode, baseline and progressive: Jpeg.decode, Jpeg.encode, Jpeg.orientation |
std/image | The Image type both codecs share, with crop, resize, rotate90, oriented |
Date, Time & IDs
| Module | What it provides |
|---|---|
std/time | Wall clock, elapsed time, Duration arithmetic/parse/format, sleep |
std/timer | Timer, Ticker, recvTimeout, waitReadable/waitWritable |
std/datetime | Date/time — DateTime.now/.fromEpoch, then dt.format(), weekdayName |
std/uuid | UUIDs — Uuid.v4, Uuid.v7, Uuid.parse |
Concurrency
| Module | What it provides |
|---|---|
std/runtime | Task.spawn, Promise / Promise.blocking, green scheduler |
std/event | kqueue/epoll/IOCP readiness polling — the layer std/runtime drives |
std/sync | Channel, WaitGroup, AtomicI64, AtomicBool — all method-based |
std/select | Wait on the first ready channel, fd or timeout: Select |
std/shard | parallelMap, parallelScanStr — divide a buffer's ownership across cores, no copy, nothing shared |
Database & Network
| Module | What it provides |
|---|---|
std/sqlite | SQLite3 bindings — dbOpen, dbQuery, dbExec, prepared statements; compile-time checked dbPrepare/dbRun/dbScalar |
std/browser | Headless Chrome over DevTools — navigate, viewport, color scheme, evaluate, PNG screenshots |
std/migrate | Versioned SQLite migrations — Migration, dbMigrate, adopting a pre-migration database, dbBackup |
std/url | URL parsing — Url.parse, then u.queryGet, u.toString |
Strings & Formatting
| Module | What it provides |
|---|---|
std/string | String methods — s.contains, s.split, s.replace, s.trim, case conversion |
std/seal | Sealed — freeze a string so stored Spans can never be invalidated |
std/fmt | Template formatting (fmt1–fmt4), padLeft/padRight, join |
std/strconv | parseInt, parseFloat, parseBool, radix conversions, formatFloat, quoteString/unquoteString |
std/unicode | UTF-8 decoding, code points, display width: codepoints, displayWidth |
Math & Random
| Module | What it provides |
|---|---|
std/math | Math.abs, Math.min, Math.max, Math.pow, Math.sqrt, Math.log, trig |
std/random | Random.int, Random.float, Random.range, Random.shuffleI64 |
std/rng | Seedable, reproducible generator: Rng.new(seed) |
Utilities
| Module | What it provides |
|---|---|
std/color | SGR text styling — Color.red, Color.green, Color.bold, etc. |
std/re | JavaScript-syntax regex in pure Milo (lookaround, backreferences, step budget): Re.new, .test, .find, .replaceAll, .split |
std/regex | Regular expression matching — Regex.compile, .isMatch, .find |
std/sort | Sorting for Vec — sortI32, sortI64, sortStrings |
std/testing | assert, assertEqual, assertStrEqual |
std/replay | The record/replay engine behind MILO_RECORD / MILO_REPLAY: replayOff, replayRet, replayBlob |
std/log | Leveled structured logging — Log, Logger, LogLevel, LogFormat |
std/mem | mmapAnon, mmapFile, Bump bump allocator |
std/pool | Fixed-size block pool allocator: Pool |
std/foreign | Borrow and adopt foreign memory: withRaw, adopt |
std/cstr | NUL-terminated C string view: CStr.wrap |
std/smt | The QF_LIA decision procedure behind milo prove |
std/prelude | Auto-imported: Error, Unit, ErrorContext |
Cryptography
OpenSSL-backed hashing plus pure-Milo hashing, MAC, and token modules (no C codec dependency; constant-time and WCET-analyzable).
| Module | What it provides |
|---|---|
std/crypto | Crypto.sha256, Crypto.sha1, Crypto.md5, and Crypto.aesGcmEncrypt/.aesGcmDecrypt (128/256-bit AES-GCM) |
std/sha256 | Pure-Milo SHA-256 — Sha256.hash, Sha256.bytes |
std/sha512 | Pure-Milo SHA-512 / SHA-384 — Sha512.hash, Sha384.bytes |
std/sha1 | Pure-Milo SHA-1 — Sha1.hash, Sha1.bytes |
std/hmac | HMAC-SHA256 / 384 / 512 / SHA-1 — Hmac.sha256, Hmac.sha512Bytes |
std/subtle | Constant-time comparison — constantTimeEq |
std/hkdf | HKDF extract-and-expand (RFC 5869) — Hkdf.sha256 |
std/pbkdf2 | Password-based KDF (RFC 8018) — Pbkdf2.sha256 |
std/jwt | JWT sign/verify (HS256/384/512) with claim validation — Jwt.signHS256, Jwt.verifyHS256, JwtVerifier |
std/totp | RFC 6238 TOTP / RFC 4226 HOTP one-time passwords — Totp.generate, Totp.hotp |
std/base32 | Base32 encode/decode (RFC 4648) — Base32.encode, Base32.decode |
Compression
Pure-Milo DEFLATE (RFC 1951) and the gzip / zlib / zip containers built on it.
| Module | What it provides |
|---|---|
std/deflate | Compress — Deflate.raw, Deflate.gzip, Deflate.zlib |
std/inflate | Decompress — Inflate.raw, Inflate.gzip, Inflate.zlib |
std/zip | Read ZIP archives — Zip.read (.zip/.jar/.epub/.docx) |
std/zstd | Zstandard: Zstd.compress, Zstd.decompress |
std/checksum | CRC-32 and Adler-32: Checksum.crc32 |
std/xxhash | XXH64: Xxhash.hash64 |