Guide

Standard library

The APIs that make sense for CLI tools and microservices — real servers, real files, real crypto — plus the browser-shaped ones that work off-browser.

HTTP server

http.listen is at 100% coverage. It transparently accepts cleartext HTTP/2 (h2c) alongside HTTP/1.1 on the same port.

import http from 'http'

interface Res {
  status: number
  body: string
  headers: Map<string, string>
}

http.listen(8080, (req: HttpRequest): Res => {
  let respHeaders: Map<string, string> = new Map<string, string>()
  respHeaders.set('Content-Type', 'text/plain')

  if (req.path === '/hello') {
    let name: string = req.query.has('name') ? req.query.get('name') : 'stranger'
    return { status: 200, body: 'hello, ' + name, headers: respHeaders }
  }

  return { status: 404, body: 'not found: ' + req.path, headers: respHeaders }
})

fetch

fetch, Request, Response and Headers are in. .text()/.json()/.arrayBuffer() are synchronous, and .json() parses a body straight into a declared type.

const r = await fetch('http://127.0.0.1:8765/get')

console.log(r.status)          // 200
console.log(r.ok)              // true

interface Ip { origin: string }

// .json() parses the body straight into a declared type
const data = r.json() as Ip
console.log(data.origin)

File system

fs reads and writes (~93%). Sync and async-shaped variants exist; async runs blocking I/O under the hood. readFileSync/writeFileSync are text-first — use the binary-aware readFileSyncBytes for binary data.

import { readFileSync, writeFileSync } from 'fs'

const config: string = readFileSync('config.json')
writeFileSync('out.txt', 'done\n')

Concurrency & workers

worker_threads and cluster give you real OS threads and processes, each running its own event loop and talking over message channels. Shared memory (SharedArrayBuffer/Atomics) is available too.

Web Crypto

A complete crypto.subtle surface over a selectable backend (OpenSSL or Apple CommonCrypto): digest, HMAC, AES-GCM/CBC, RSA-OAEP/PSS, ECDSA, PBKDF2/HKDF, key formats raw/pkcs8/spki/jwk.

The rest

AreaNotes
StreamsWeb + Node streams (options-form), 100%
URL / URLSearchParams100% (one value per key)
WebSocket / SSEClient & server; client speaks wss://
events (EventEmitter)100%, single payload type per emitter
path / os100% (POSIX; Linux + Apple Silicon verified)
net / dns / dgram / tls / http2 / zlibDone (tls = client + server); vm not started