Skip to content

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 ​

ModuleWhat it provides
std/ioreadStdin, writeStdout, File.openRead/.openWrite/.openAppend, f.readAll(), f.writeAll(), RAII file handles
std/fsreadFile, readLines, readDir, fileInfo, isDir/isFile, pathExists, writeFile
std/pathPath.join, Path.basename, Path.dirname, Path.ext, Path.stem
std/envEnv.get, Env.getOr

Networking ​

ModuleWhat it provides
std/netTCP, DNS
std/fetchHTTP client: fetch, fetchWith, redirects, and the TLS client socket TlsStream
std/tlsTLS server transport: TlsListener.bind, accept
std/httpsHTTPS server: serveTls, serveRouterTls
std/wsWebSocket client and server: wsAccept, wsConnect, WsConn
std/wsframeWebSocket wire format, no IO: computeAcceptKey, encodeWsFrame, parseWsFrame
std/chunkedHTTP/1.1 chunked transfer coding, no IO: ChunkScan, decodeChunked
std/unixUnix-domain sockets: UnixListener, UnixStream
std/httpHTTP server with Hono-style router, context, middleware
std/httpmwOptional HTTP middleware: gzip, verifyBearer
std/webpushWeb Push: payload encryption (RFC 8291) and VAPID headers (RFC 8292): WebPush.encrypt, WebPush.vapid, VapidKeys
std/htmlHTML escaping — Html.escapeText, Html.escapeAttr, Html.isSafeUrl
std/mimeMedia types by extension — Mime.fromPath, Mime.contentType
std/multipartmultipart/form-data parsing — Multipart.parse, Part.safeFilename

Data ​

ModuleWhat it provides
std/jsonZero-copy JSON parser: Json.parse, keyed accessors (.str(), .i64(), .f64(), .bool()). Serializing a struct is the built-in jsonStringify, no import
std/arenaGenerational arena for cyclic/graph data with safe Handle<T>; the how-to is Patterns
std/setHashSet<T> — s.add, s.contains, s.remove
std/collectionsBinaryHeap, Deque, SortedMap (B-tree), OrderedMap, Counter, bisectLeft/insertSorted
std/cacheLruCache and TtlCache (per-entry expiry, optional LRU capacity)

CLI & System ​

ModuleWhat it provides
std/argparseCLI argument parsing with typed getters and --help generation
std/argsRaw CLI arguments — args(), getFlag, hasFlag
std/processCommand execution, Process.spawn/.wait()/.signal(), run, capture
std/signalPOSIX signal handling — onSignal, ignoreSignal
std/termTerminal raw mode and size: enableRawMode, terminalSize
std/keysDecode terminal input bytes into keys: decodeKey, KeyCode
std/ansiCursor, screen and 256/24-bit color escapes: Ansi.cursorTo, Ansi.fg256
std/ptyPseudoterminals: Pty.open, openAndSpawn
std/sysinfoHost and process info: hostname, cpuCount, totalMem, cwd
std/environThe whole environment: envVars
std/osTyped libc bindings the rest of std is built on
std/dlLoad shared libraries at run time: dlOpen, Lib.sym

Data Formats ​

ModuleWhat it provides
std/csvCSV parsing with header support — Csv.parse, Csv.stringify
std/xmlStrict XML 1.0: a pull parser (XmlReader) and an owned tree (Xml.parse, XmlNode)
std/base64Base64 encode/decode — Base64.encode, Base64.decode
std/hexHex encode/decode — Hex.encode, Hex.decode
std/binaryFixed-width int/float codecs — Bytes.readU32Le, Bytes.writeI16Be, both byte orders
std/pngPNG encode/decode: Png.encode, Png.decode
std/jpegJPEG encode/decode, baseline and progressive: Jpeg.decode, Jpeg.encode, Jpeg.orientation
std/imageThe Image type both codecs share, with crop, resize, rotate90, oriented

Date, Time & IDs ​

ModuleWhat it provides
std/timeWall clock, elapsed time, Duration arithmetic/parse/format, sleep
std/timerTimer, Ticker, recvTimeout, waitReadable/waitWritable
std/datetimeDate/time — DateTime.now/.fromEpoch, then dt.format(), weekdayName
std/uuidUUIDs — Uuid.v4, Uuid.v7, Uuid.parse

Concurrency ​

ModuleWhat it provides
std/runtimeTask.spawn, Promise / Promise.blocking, green scheduler
std/eventkqueue/epoll/IOCP readiness polling — the layer std/runtime drives
std/syncChannel, WaitGroup, AtomicI64, AtomicBool — all method-based
std/selectWait on the first ready channel, fd or timeout: Select
std/shardparallelMap, parallelScanStr — divide a buffer's ownership across cores, no copy, nothing shared

Database & Network ​

ModuleWhat it provides
std/sqliteSQLite3 bindings — dbOpen, dbQuery, dbExec, prepared statements; compile-time checked dbPrepare/dbRun/dbScalar
std/browserHeadless Chrome over DevTools — navigate, viewport, color scheme, evaluate, PNG screenshots
std/migrateVersioned SQLite migrations — Migration, dbMigrate, adopting a pre-migration database, dbBackup
std/urlURL parsing — Url.parse, then u.queryGet, u.toString

Strings & Formatting ​

ModuleWhat it provides
std/stringString methods — s.contains, s.split, s.replace, s.trim, case conversion
std/sealSealed — freeze a string so stored Spans can never be invalidated
std/fmtTemplate formatting (fmt1–fmt4), padLeft/padRight, join
std/strconvparseInt, parseFloat, parseBool, radix conversions, formatFloat, quoteString/unquoteString
std/unicodeUTF-8 decoding, code points, display width: codepoints, displayWidth

Math & Random ​

ModuleWhat it provides
std/mathMath.abs, Math.min, Math.max, Math.pow, Math.sqrt, Math.log, trig
std/randomRandom.int, Random.float, Random.range, Random.shuffleI64
std/rngSeedable, reproducible generator: Rng.new(seed)

Utilities ​

ModuleWhat it provides
std/colorSGR text styling — Color.red, Color.green, Color.bold, etc.
std/reJavaScript-syntax regex in pure Milo (lookaround, backreferences, step budget): Re.new, .test, .find, .replaceAll, .split
std/regexRegular expression matching — Regex.compile, .isMatch, .find
std/sortSorting for Vec — sortI32, sortI64, sortStrings
std/testingassert, assertEqual, assertStrEqual
std/replayThe record/replay engine behind MILO_RECORD / MILO_REPLAY: replayOff, replayRet, replayBlob
std/logLeveled structured logging — Log, Logger, LogLevel, LogFormat
std/memmmapAnon, mmapFile, Bump bump allocator
std/poolFixed-size block pool allocator: Pool
std/foreignBorrow and adopt foreign memory: withRaw, adopt
std/cstrNUL-terminated C string view: CStr.wrap
std/smtThe QF_LIA decision procedure behind milo prove
std/preludeAuto-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).

ModuleWhat it provides
std/cryptoCrypto.sha256, Crypto.sha1, Crypto.md5, and Crypto.aesGcmEncrypt/.aesGcmDecrypt (128/256-bit AES-GCM)
std/sha256Pure-Milo SHA-256 — Sha256.hash, Sha256.bytes
std/sha512Pure-Milo SHA-512 / SHA-384 — Sha512.hash, Sha384.bytes
std/sha1Pure-Milo SHA-1 — Sha1.hash, Sha1.bytes
std/hmacHMAC-SHA256 / 384 / 512 / SHA-1 — Hmac.sha256, Hmac.sha512Bytes
std/subtleConstant-time comparison — constantTimeEq
std/hkdfHKDF extract-and-expand (RFC 5869) — Hkdf.sha256
std/pbkdf2Password-based KDF (RFC 8018) — Pbkdf2.sha256
std/jwtJWT sign/verify (HS256/384/512) with claim validation — Jwt.signHS256, Jwt.verifyHS256, JwtVerifier
std/totpRFC 6238 TOTP / RFC 4226 HOTP one-time passwords — Totp.generate, Totp.hotp
std/base32Base32 encode/decode (RFC 4648) — Base32.encode, Base32.decode

Compression ​

Pure-Milo DEFLATE (RFC 1951) and the gzip / zlib / zip containers built on it.

ModuleWhat it provides
std/deflateCompress — Deflate.raw, Deflate.gzip, Deflate.zlib
std/inflateDecompress — Inflate.raw, Inflate.gzip, Inflate.zlib
std/zipRead ZIP archives — Zip.read (.zip/.jar/.epub/.docx)
std/zstdZstandard: Zstd.compress, Zstd.decompress
std/checksumCRC-32 and Adler-32: Checksum.crc32
std/xxhashXXH64: Xxhash.hash64