Standard library
Everything that ships with the compiler. Each package has a walkthrough and its full API, generated from its source.
Import a package with import "std:name". Nothing to install: every package here is part of the compiler.
Web and networking
HTTP servers and clients, WebSockets, raw sockets and remote file systems.
serveRuns HTTP servers with routes, middleware, templates, static files and WebSocket endpoints.wsRuns WebSocket servers and opens WebSocket client connections that exchange text, binary and JSON messages.requestsSends HTTP requests and returns their responses, whole or as streams of lines and server-sent events.urlParses, builds, resolves and escapes URLs and query strings.netOpens TCP, Unix and UDP sockets and resolves host names; use std:requests for HTTP and std:url for URLs.mimeLooks up media types by file extension and parses and formats Content-Type values.ftpConnects to FTP servers to list, upload, download, rename and delete remote files and directories.sshConnects to SSH servers with host-key verification to run commands, read, write and manage files over SFTP and forward ports, and manages SSH keys.s3Uploads, downloads and deletes objects in Amazon S3 and S3-compatible storage such as R2 and MinIO, and signs presigned URLs.webpushSends Web Push notifications to browser subscriptions, with VAPID keys, signing and RFC 8291 payload encryption.emailComposes email messages with attachments and sends them through an SMTP server.torrentCreates, reads and writes BitTorrent metainfo (.torrent) files and magnet links, and downloads and seeds torrents as a BitTorrent client.Apps and graphics
Desktop interfaces, windows, games, 2D physics and GPU shaders.
uiBuild interfaces from tags written in OSL, shown as live web pages by std:serve's app.UI and as native windows by std:window.windowOpen native windows that show std:ui interfaces, drawn with SDL2, with menus, dialogs, shortcuts and the clipboard.layoutLay out std:ui tags in boxes without a screen: build nodes, measure them, find what sits at a point, and inspect and change a tree.raylibraylib windows with 2D and 3D drawing, keyboard and mouse input, textures, images, shaders and render textures, exchanging pixels with img.ImagerayguiImmediate-mode GUI controls for raylib windows: buttons, toggles, sliders, text fields, lists, dropdowns, color pickers, dialogs and stylesbox2dBox2D rigid-body physics: worlds of static, dynamic and kinematic bodies built from box, circle and polygon shapesshaderTranspile OSL-style shader code into GLSL for raylib, with example shaderscanvasThe built-in canvas pixel buffer is deprecated; see what it did and how to move the same code to std:img.svgRender SVG documents into img.Image values, read their size and viewBox, and register fonts for SVG textData and formats
Parse, validate, transform and write structured text.
jsonParse, stringify and stream JSON text.schemaValidate and normalise OSL values against composable schemas.yamlParse and stringify YAML text.csvParse and write CSV text as arrays of objects or rows of cells.xmlParse, query, edit and write XML documents.mdConverts Markdown (with GitHub tables, task lists and strikethrough) to HTML and HTML back to Markdown.templateFills {{ }} templates from an object, with {{#if}}, {{#unless}} and {{#each}} blocks and optional HTML escaping.diffCompare texts line by line, word by word or character by character and format the differences.encodings/utf16Measures, indexes, orders and case-maps strings like JavaScript does, counting UTF-16 code units with 1-based positions.Storage
Databases, key-value saves, caches and configuration.
dbSQLite databases with SQL queries and JSON document collections.savePersistent per-app storage of named text items under ~/.osl/apps.cacheIn-memory key-value caches that evict the least recently used entry and expire entries after a time to live.envRead and set environment variables, and load, edit and save .env files.memInspect the program's memory use, write pprof profiles and serve live profiling data.Files and the system
Files, processes, the terminal, logging and archives.
fsRead, write and manage files and directories, and work with path strings.processRun commands and manage processes, and read the current program's arguments, working directory and IDs.sysInformation about the operating system, machine and user, and opening URLs in the default app.tuiBuilds terminal interfaces: colours and styles, boxes, tables and charts as strings, cursor control, prompts, key input and a redrawable screen buffer.logLevelled, timestamped console logging with a history of recent entries and progress output.notifyShow desktop notifications and alert dialogs on macOS, Linux and Windows.zipCreate, inspect and extract ZIP and tar archives, and gzip files and strings.Concurrency
Threads, channels, locks, events, retries and schedules.
threadRun functions on threads, wait for their results, and pass values between them over channels.syncLock values, one-time initialisation and wait groups for coordinating threads.eventsNamed in-process events whose listeners can be added, removed and emitted from any thread.retryCall a function again after it fails, waiting longer between attempts.cronRun functions on five-field cron schedules from a background scheduler.Security
Hashing, encryption, signatures and tokens.
Text, numbers and time
Maths, randomness, dates, regular expressions, versions and emoji.
mathMath functions and constants beyond the built-ins: trigonometry, number theory, statistics and binary64 primitives.randomFast seedable pseudo-random numbers, items, shuffles and strings; use crypto for secrets.dateDates, times and durations: date.DateTime instants in UTC, time zones, arithmetic, formatting and parsing.regexRegular expressions from strings (RE2 syntax), compiled patterns, and text validators and extractors built on them.semverParse, compare and range-match semantic versions such as "1.4.0-rc.1".emojiFinds, counts, extracts and removes emoji in text, counting flags, keycaps, skin tones and ZWJ sequences as one emoji each.colorsParse CSS colors into OSL colors and convert, mix, lighten and darken themMedia and documents
Images, photos' metadata, QR codes, PDFs and sound.
imgCreate, draw on, filter, inspect, decode and encode images, with shapes, paths, gradients and text, every frame of animated GIF, PNG and WebP files, and ICC color profiles kept throughoutexifRead the EXIF orientation of JPEG, PNG, WebP and TIFF images and remove their EXIF metadata without re-encodingqrMakes QR codes and Code 128, EAN-13, UPC-A and Code 39 barcodes as images, and reads them back.pdfCreates PDF documents with text, shapes, images, tables, bookmarks and watermarks, and merges and splits PDFs it wrote.soundPlay WAV, MP3, OGG Vorbis and QOA audio with per-sound volume, pitch, pan, pause and seekingValues and types
Results, options, sets, maps and pointers.
resultThe result<T, E> type: the value of an operation that succeeded, or the error it failed with.optionThe option type: some(value) or none(), for an optional value whose absence must be told apart from null.setKeep a collection of unique values with fast membership tests, and combine sets with union, intersection and difference.mapLook values up by key with map(), whose keys can be strings, numbers or booleans, and know when a typed map or an object fits better.ptrShared mutable cells and low-level identity, address and memory-layout queries.Embedding and testing
Run JavaScript and Lua inside OSL, and test your code.
jsRun JavaScript in a sandboxed QuickJS runtime with a hard timeout, a memory cap and no access to the host.luaRun Lua 5.1 code with gopher-lua, in one-off calls or in lua.State handles that keep globals, call Lua functions and expose OSL ones.testingAssertions for OSL tests that throw an AssertionError naming what went wrong.Accounts and chat bots
Rotur accounts and originChats bots.