[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D3T2CWCM6PFVFG971JAQJ7":3,"skill-same:01M7D3T2CWCM6PFVFG971JAQJ7":109},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7D3T2CWCM6PFVFG971JAQJ7","bun-api",null,"Bun runtime API reference for TypeScript scripts. Covers Bun.serve() HTTP\u002FHTTP\u002F2 server with routes and WebSockets, fetch() transport options, proxies and Bun.FetchSession connection pools, Bun.ModuleGraph multi-instance apps, Bun.file(), Bun.write(), Bun.$() shell, Bun.spawn(), Bun.Glob, Bun.env, bun:sqlite, Bun.sql() for PostgreSQL\u002FMySQL via DATABASE_URL, Bun.s3 for S3-compatible storage, Bun.redis for Redis\u002FValkey, Bun.Archive for tarballs, Bun.Image image processing, Bun.WebView headless browser automation, Bun.cron scheduling, Bun.secrets OS credential storage, Bun.Terminal PTYs, JSONC\u002FJSON5\u002FJSONL\u002FXML\u002FTOML\u002FYAML\u002Fmarkdown parsers, Bun.hash, Bun.password, compression, and scripting utilities. Use when writing scripts, automating tasks, querying databases, working with S3 storage, Redis caching, processing images, automating a headless browser, parsing markdown\u002FJSON variants, or doing file processing in a Bun project. Signals: bun.lock, bunfig.toml, DATABASE_URL, REDIS_URL, AWS_ACCESS_KEY_ID, Bun.$ usage Not for bun CLI commands (bun-cli skill), non-Bun runtimes, or ORM CLI tooling","datamonsterr\u002Fother-skill","datamonsterr","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F94211882?v=4","01M753RPEB0GWGMAQK66KRXW1S","Pham Dat","01M7D3SZKK01PFJSY7QM4FBXKP",3,"MIT","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bun-api\ndescription: >-\n  Bun runtime API reference for TypeScript scripts. Covers Bun.serve() HTTP\u002FHTTP\u002F2 server\n  with routes and WebSockets, fetch() transport options, proxies and Bun.FetchSession\n  connection pools, Bun.ModuleGraph multi-instance apps, Bun.file(), Bun.write(),\n  Bun.$() shell, Bun.spawn(), Bun.Glob, Bun.env, bun:sqlite, Bun.sql() for PostgreSQL\u002FMySQL\n  via DATABASE_URL, Bun.s3 for S3-compatible storage, Bun.redis for Redis\u002FValkey,\n  Bun.Archive for tarballs, Bun.Image image processing, Bun.WebView headless browser\n  automation, Bun.cron scheduling, Bun.secrets OS credential storage, Bun.Terminal PTYs,\n  JSONC\u002FJSON5\u002FJSONL\u002FXML\u002FTOML\u002FYAML\u002Fmarkdown parsers,\n  Bun.hash, Bun.password, compression, and scripting utilities. Use when writing scripts,\n  automating tasks, querying databases, working with S3 storage, Redis caching, processing\n  images, automating a headless browser, parsing markdown\u002FJSON variants, or doing file\n  processing in a Bun project. Signals: bun.lock, bunfig.toml,\n  DATABASE_URL, REDIS_URL, AWS_ACCESS_KEY_ID, Bun.$ usage\n  Not for bun CLI commands (bun-cli skill), non-Bun runtimes, or ORM CLI tooling\n---\n\n# Bun Runtime API\n\nBun runs TypeScript natively — no `tsc` compilation, no `ts-node`, no build step. Run any `.ts` file directly with `bun file.ts`; running never type checks, so use `bun check` (v1.4.3+, see the `bun-cli` skill) for that. Use Bun's native APIs instead of Node.js equivalents — they're faster, more ergonomic, and require no additional dependencies.\n\n**Critical**: In a Bun project (has `bun.lock`, `bun.lockb`, `bunfig.toml`, or `bun-types` \u002F `@types\u002Fbun` in devDependencies), always use Bun to run scripts (`bun file.ts`, not `node file.ts`) and prefer Bun-native APIs over Node.js equivalents. Mixing runtimes causes subtle bugs and unnecessary retries.\n\n**Verified against Bun v1.4.3** (2026-10-10). Features are tagged with the version that\nintroduced them (`v1.4+`, `v1.4.1+`, `v1.4.2+`, `v1.4.3+`). Where a release changed existing\nbehavior, both behaviors are stated so this skill stays correct on older projects -- check\n`bun --version` before relying on a version-tagged item.\n\n## Read Bun's Own Docs First\n\nBun ships its complete documentation inside `bun-types`, version-matched to the runtime.\nIn any project with `bun-types` or `@types\u002Fbun` installed:\n\n```text\nnode_modules\u002Fbun-types\u002Fdocs\u002F**\u002F*.mdx   # full docs, plus ~180 task-shaped guides\u002F\nnode_modules\u002Fbun-types\u002F*.d.ts          # richest API surface (bun.d.ts, serve.d.ts, sql.d.ts)\nnode_modules\u002Fbun-types\u002FCLAUDE.md       # Bun's own agent rules\n```\n\n**Consult them before writing non-trivial Bun code.** This skill covers which API to reach\nfor; the shipped docs cover exact signatures and options.\n\n1. **Depend on `bun-types`, not `@types\u002Fbun`.** `bun-types` ships with every Bun release and\n   carries both the docs and the types. `@types\u002Fbun` lags every release, often by a day or\n   more, yet `bun init` adds it as `latest`, so the newest APIs fail type checking (`TS2339`,\n   `TS2353`). Adding `bun-types` beside `@types\u002Fbun` fixes only the docs path -- type checking\n   keeps `@types\u002Fbun`'s nested, pinned copy. Switch both, then compare `bun --version` with\n   `node_modules\u002Fbun-types\u002Fpackage.json`:\n\n   ```bash\n   bun remove @types\u002Fbun\n   bun add -d bun-types@$(bun --version)   # then \"types\": [\"bun-types\"] in tsconfig.json\n   ```\n2. **Open by explicit path.** With Bun's global virtual store enabled, `node_modules\u002Fbun-types`\n   is a symlink: `find node_modules -name '*.mdx'` and `rg \u003Cpattern> node_modules` return\n   nothing, while `find node_modules\u002Fbun-types\u002Fdocs -name '*.mdx'` works.\n3. **Never edit files under `node_modules\u002F`.** Under the global store, every project on the\n   machine shares the same inode -- a write there hits all of them. Use `bun patch`.\n4. **Not installed?** The same path works online: `docs\u002Fruntime\u002Fsql.mdx` is\n   `https:\u002F\u002Fbun.com\u002Fdocs\u002Fruntime\u002Fsql`.\n\n| Task | Doc path (under `node_modules\u002Fbun-types\u002Fdocs\u002F`) |\n|---|---|\n| HTTP server, routes, WebSockets | `runtime\u002Fhttp\u002Fserver.mdx`, `runtime\u002Fhttp\u002Frouting.mdx`, `runtime\u002Fhttp\u002Fwebsockets.mdx` |\n| `fetch`, TCP, UDP, DNS | `runtime\u002Fnetworking\u002Ffetch.mdx`, `runtime\u002Fnetworking\u002Ftcp.mdx`, `runtime\u002Fnetworking\u002Fudp.mdx`, `runtime\u002Fnetworking\u002Fdns.mdx` |\n| File I\u002FO, streams, binary data | `runtime\u002Ffile-io.mdx`, `runtime\u002Fstreams.mdx`, `runtime\u002Fbinary-data.mdx` |\n| Shell, subprocesses, PTY | `runtime\u002Fshell.mdx`, `runtime\u002Fchild-process.mdx` |\n| SQL, SQLite, Redis, S3 | `runtime\u002Fsql.mdx`, `runtime\u002Fsqlite.mdx`, `runtime\u002Fredis.mdx`, `runtime\u002Fs3.mdx` |\n| Parsers | `runtime\u002Fjson5.mdx`, `runtime\u002Fjsonl.mdx`, `runtime\u002Fxml.mdx`, `runtime\u002Ftoml.mdx`, `runtime\u002Fyaml.mdx`, `runtime\u002Fmarkdown.mdx`, `runtime\u002Ffile-types.mdx` |\n| Images, WebView, cron, secrets, archives | `runtime\u002Fimage.mdx`, `runtime\u002Fwebview.mdx`, `runtime\u002Fcron.mdx`, `runtime\u002Fsecrets.mdx`, `runtime\u002Farchive.mdx` |\n| Hashing, utils, semver, glob, cookies, CSRF | `runtime\u002Fhashing.mdx`, `runtime\u002Futils.mdx`, `runtime\u002Fsemver.mdx`, `runtime\u002Fglob.mdx`, `runtime\u002Fcookies.mdx`, `runtime\u002Fcsrf.mdx` |\n| App instances, string-eval lockdown (v1.4.3+) | `runtime\u002Fmodule-graph.mdx`, `runtime\u002Fcode-generation-from-strings.mdx` |\n| Node.js compatibility | `runtime\u002Fnodejs-compat.mdx` |\n\n## When to Use\n\n- Scripts for generating files, parsing data, running migrations\n- File processing and transformation pipelines\n- Shell scripting and automation\n- Database operations with SQLite (`bun:sqlite`)\n- **Database queries via connection URL** -- project has `DATABASE_URL` in `.env` or environment (PostgreSQL, MySQL, SQLite via `Bun.sql()`)\n- **S3 storage operations** -- project has `AWS_ACCESS_KEY_ID` or uses S3-compatible storage (`Bun.s3`)\n- **Redis\u002FValkey caching and pub\u002Fsub** -- project has `REDIS_URL` or `VALKEY_URL` (`Bun.redis`)\n- Any scripting task in a Bun project\n\n## HTTP Server (Bun.serve)\n\nBuilt-in HTTP server — replaces Express, Fastify, or `http.createServer`.\n\nPrefer `routes` over hand-rolled `URL` parsing -- it gives you params, per-method handlers,\nand zero-allocation static responses. `fetch` is the fallback for unmatched requests.\n\n```typescript\nconst server = Bun.serve({\n  port: 3000,\n\n  routes: {\n    '\u002Fhealth': new Response('OK'),                    \u002F\u002F static, zero-allocation\n    '\u002Fapi\u002Fusers\u002F:id': req => Response.json({ id: req.params.id }),\n    '\u002Fapi\u002Fposts': {                                   \u002F\u002F per-method handlers\n      GET: () => Response.json(listPosts()),\n      POST: async req => Response.json(await req.json()),\n    },\n    '\u002Fstatic\u002F*': { dir: '.\u002Fpublic' },                 \u002F\u002F serve a directory (v1.4+)\n  },\n\n  fetch(req: Request): Response | Promise\u003CResponse> {  \u002F\u002F unmatched requests\n    return new Response('Not Found', { status: 404 })\n  },\n\n  error(error: Error): Response {\n    return new Response(`Error: ${error.message}`, { status: 500 })\n  },\n})\n\nconsole.log(`Listening on ${server.url}`)\n```\n\nRoute precedence: exact > `:param` > `*` > global `\u002F*`. A registered `'\u002F*'` route catches\nevery unmatched path, so `fetch` only runs when no `'\u002F*'` route exists -- use one or the\nother as the fallback, not both. Handlers receive a `BunRequest` (a `Request` plus `params`\nand `cookies`).\n\nKey methods: `server.stop()`, `server.reload()` (hot-swap handler), `server.requestIP(req)`, `server.upgrade(req)` (WebSocket).\n\n**HTTP\u002F2 (v1.4.1+, experimental).** `http2: true` serves HTTP\u002F2 and HTTP\u002F1.1 on one port with\nthe same `routes` and `fetch`: ALPN picks the protocol over TLS, and a cleartext connection\nthat opens with the HTTP\u002F2 preface (`curl --http2-prior-knowledge`, `node:http2`) gets HTTP\u002F2.\n`http1: false` refuses HTTP\u002F1.x clients. `server.upgrade()` (WebSockets) and response\ntrailers are HTTP\u002F1.1-only, so gRPC does not work over it yet.\n\n**File responses resume safely (v1.4.3+).** `Bun.file()` bodies and `{ dir }` routes already\nanswer `Range` with `206`; they now also honor `If-Range`. The range is sent only when\n`If-Range` matches the `Last-Modified` date or a strong `ETag` the response carries (Bun sets\nnone on a `Bun.file()` response -- add your own), and any other `If-Range` value gets the full\n`200`. A `{ dir }` route's weak `ETag` never matches. Bun 1.4.2 ignored `If-Range` and always\nsent the range.\n\n> **Reference**: See `references\u002Fhttp-server.md` for TLS, WebSocket upgrade, streaming\n> responses, static file serving, and 1.4 behavior changes. Full API in\n> `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fhttp\u002Fserver.mdx` and `runtime\u002Fhttp\u002Frouting.mdx`.\n\n## TCP \u002F UDP Sockets\n\nRaw sockets for non-HTTP protocols -- `Bun.listen()` \u002F `Bun.connect()` for TCP, `Bun.udpSocket()` for UDP, plus the built-in `WebSocket` client and `fetch()`.\n\n```typescript\nconst server = Bun.listen({\n  hostname: '127.0.0.1',\n  port: 8080,\n  socket: {\n    open(socket) { socket.write('welcome\\n') },\n    data(socket, data) { \u002F* Buffer *\u002F },\n  },\n})\n```\n\n> **Reference**: See `references\u002Fnetworking.md` for TCP\u002FUDP handlers, Unix sockets, the WebSocket client (`ws+unix:\u002F\u002F`), and `fetch()` transport options (HTTP\u002F2, HTTP\u002F3, proxies, system CA).\n\n## fetch() Sessions and Proxies (v1.4.3+)\n\n`Bun.FetchSession` gives a group of requests their own TLS, proxy, and keep-alive settings and a\nprivate connection pool. Reach for it instead of an `undici` `Agent` \u002F `dispatcher`: Bun's\nbuilt-in `undici` exports those classes so imports succeed, but `fetch()` ignores `dispatcher`.\n\n```typescript\nconst session = new Bun.FetchSession({\n  tls: { ca: await Bun.file('corp-ca.pem').text() },\n  proxy: { url: 'http:\u002F\u002Fproxy.internal:8080' },\n  keepAlive: { idleTimeout: 30, maxIdleSockets: 8 },   \u002F\u002F false: a new connection per request\n})\n\nconst client = new SomeClient({ fetch: session.fetch }) \u002F\u002F bound -- hand it to any client\nawait fetch('https:\u002F\u002Fapi.example.com\u002Fv1', { session })  \u002F\u002F the same, through the global fetch\nsession.close()                                         \u002F\u002F closes idle connections; stays usable\n```\n\n- Sessions never share a connection with each other or with plain `fetch()`. Request options\n  override the session's, and a request's `tls` replaces the session's `tls` as a whole.\n- **Pin certificates on the session, not the request.** A per-request\n  `tls.checkServerIdentity` opens a dedicated TLS connection and closes it after the response\n  (3 requests: 3 handshakes; 1.4.2 reused one). On a session it runs once per connection, which\n  is then pooled.\n- `session.fetch` has no `preconnect`; where an option is typed `typeof fetch`, pass\n  `session.fetch as typeof fetch`.\n\n**Proxy selection.** `proxy: false` connects directly whatever `HTTP_PROXY` \u002F `HTTPS_PROXY` \u002F\n`ALL_PROXY` say. `ALL_PROXY` now applies when the scheme-specific variable is unset (1.4.2\nignored it). `NO_PROXY` accepts `*.example.com`, CIDR blocks (`10.0.0.0\u002F8`), bare IPv6, and\n`host:port`, and also bypasses an explicit `proxy` unless that sets `respectNoProxy: false`. A\nproxy that refuses `CONNECT` makes `fetch()` reject with `ERR_PROXY_TUNNEL` -- 1.4.2 resolved\nwith the proxy's reply as if the origin had sent it:\n\n```typescript\ntry {\n  await fetch(url, { proxy: { url: 'http:\u002F\u002Fproxy.internal:8080', respectNoProxy: false } })\n} catch (e: any) {\n  if (e.code === 'ERR_PROXY_TUNNEL') console.error(e.status, e.headers.get('proxy-authenticate'))\n}\n```\n\n> **Reference**: See `references\u002Fnetworking.md` for session options, the `NO_PROXY` syntax, and\n> `checkServerIdentity` rules; `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fnetworking\u002Ffetch.mdx`.\n\n## File I\u002FO\n\n### Reading Files\n\n```typescript\n\u002F\u002F Create a BunFile reference (lazy, no read yet)\nconst file = Bun.file('path\u002Fto\u002Ffile.txt')\n\n\u002F\u002F Read contents\nconst text = await file.text()           \u002F\u002F string\nconst json = await file.json()           \u002F\u002F parsed JSON\nconst bytes = await file.arrayBuffer()   \u002F\u002F ArrayBuffer\nconst stream = file.stream()             \u002F\u002F ReadableStream\nconst blob = await file.blob()           \u002F\u002F Blob\n\n\u002F\u002F File metadata\nfile.size                                \u002F\u002F Size in bytes\nfile.type                                \u002F\u002F MIME type (auto-detected)\nfile.name                                \u002F\u002F File path\nawait file.exists()                      \u002F\u002F Boolean\n\n\u002F\u002F Read from URL\nconst remote = Bun.file('https:\u002F\u002Fexample.com\u002Fdata.json')\n```\n\n### Writing Files\n\n```typescript\n\u002F\u002F Write string\nawait Bun.write('output.txt', 'content')\n\n\u002F\u002F Write from BunFile (efficient copy)\nawait Bun.write('copy.txt', Bun.file('original.txt'))\n\n\u002F\u002F Write JSON\nawait Bun.write('data.json', JSON.stringify(data, null, 2))\n\n\u002F\u002F Write Uint8Array \u002F ArrayBuffer\nawait Bun.write('binary.dat', new Uint8Array([1, 2, 3]))\n\n\u002F\u002F Write a Response body -- streamed to disk (v1.4.1+; the whole body was buffered before)\nawait Bun.write('page.html', await fetch('https:\u002F\u002Fexample.com'))\n\n\u002F\u002F Write to stdout\nawait Bun.write(Bun.stdout, 'Hello\\n')\n```\n\n### Stdio\n\n```typescript\nBun.stdin    \u002F\u002F BunFile for stdin\nBun.stdout   \u002F\u002F BunFile for stdout\nBun.stderr   \u002F\u002F BunFile for stderr\n\n\u002F\u002F Read all of stdin\nconst input = await Bun.stdin.text()\n\n\u002F\u002F Stream stdin line by line\nfor await (const chunk of Bun.stdin.stream()) {\n  \u002F\u002F process chunk (Uint8Array)\n}\n```\n\n### Common Patterns\n\n```typescript\n\u002F\u002F JSON transform\nconst data = await Bun.file('input.json').json()\ndata.version = '2.0.0'\nawait Bun.write('output.json', JSON.stringify(data, null, 2))\n\n\u002F\u002F File generation from template\nconst template = await Bun.file('template.html').text()\nconst output = template.replace('{{title}}', 'My Page')\nawait Bun.write('index.html', output)\n\n\u002F\u002F Check if file exists before reading\nconst file = Bun.file('config.json')\nif (await file.exists()) {\n  const config = await file.json()\n}\n```\n\n> **Reference**: See `references\u002Ffile-io.md` for BunFile interface, write overloads, streaming, MIME detection, and file watching.\n\n## Shell and Process Execution\n\n### Bun.$ (Tagged Template Shell)\n\nThe primary way to run shell commands. Returns a promise with output.\n\n```typescript\nimport { $ } from 'bun'\n\n\u002F\u002F Basic execution\nconst result = await $`ls -la`\nconsole.log(result.text())          \u002F\u002F stdout as string\n\n\u002F\u002F With interpolation (auto-escaped)\nconst dir = 'my folder'\nawait $`ls ${dir}`                   \u002F\u002F Safe: \"my folder\" is properly quoted\n\n\u002F\u002F Output methods\nconst output = await $`echo hello`\noutput.text()                        \u002F\u002F \"hello\\n\"\noutput.json()                        \u002F\u002F Parse stdout as JSON\noutput.lines()                       \u002F\u002F string[] (splits on newlines)\noutput.bytes()                       \u002F\u002F Uint8Array\noutput.blob()                        \u002F\u002F Blob\noutput.exitCode                      \u002F\u002F number\noutput.stderr                        \u002F\u002F Buffer\n\n\u002F\u002F Piping\nawait $`cat file.txt | grep pattern | wc -l`\n\n\u002F\u002F Quiet mode (suppress stdout)\nawait $`npm install`.quiet()\n\n\u002F\u002F No-throw mode (don't throw on non-zero exit)\nconst result = await $`command-that-might-fail`.nothrow()\nif (result.exitCode !== 0) {\n  console.error('Failed:', result.stderr.toString())\n}\n\n\u002F\u002F Combined\nawait $`risky-command`.quiet().nothrow()\n\n\u002F\u002F Environment variables\nawait $`echo $HOME`.env({ HOME: '\u002Fcustom' })\n\n\u002F\u002F Working directory\nawait $`ls`.cwd('\u002Ftmp')\n\n\u002F\u002F Redirect to file\nawait $`echo hello > output.txt`\nawait $`cat \u003C input.txt`\n\n\u002F\u002F Pipe between commands\nconst input = Buffer.from('hello')\nawait $`cat`.stdin(input)\n```\n\n### Bun.spawn (Lower-Level)\n\nFor more control over process execution.\n\n```typescript\nconst proc = Bun.spawn(['command', 'arg1', 'arg2'], {\n  cwd: '\u002Fpath',\n  env: { ...process.env, CUSTOM: 'value' },\n  stdin: 'pipe',          \u002F\u002F 'pipe' | 'inherit' | 'ignore' | BunFile | Blob | Response\n  stdout: 'pipe',         \u002F\u002F 'pipe' | 'inherit' | 'ignore' | BunFile\n  stderr: 'pipe',         \u002F\u002F 'pipe' | 'inherit' | 'ignore' | BunFile\n  onExit(proc, exitCode, signalCode, error) {\n    \u002F\u002F Called when process exits\n  },\n})\n\n\u002F\u002F Write to stdin\nproc.stdin.write('input data')\nproc.stdin.end()\n\n\u002F\u002F Read stdout\nconst output = await new Response(proc.stdout).text()\n\n\u002F\u002F Wait for completion\nawait proc.exited                    \u002F\u002F Promise\u003Cnumber> (exit code)\n\n\u002F\u002F Kill\nproc.kill()                          \u002F\u002F SIGTERM\nproc.kill('SIGKILL')                 \u002F\u002F Specific signal\n```\n\n### Bun.spawnSync (Synchronous)\n\n```typescript\nconst result = Bun.spawnSync(['command', 'arg1'], {\n  cwd: '\u002Fpath',\n  env: { ...process.env },\n})\n\nresult.exitCode     \u002F\u002F number\nresult.stdout       \u002F\u002F Buffer\nresult.stderr       \u002F\u002F Buffer\nresult.success      \u002F\u002F boolean\n```\n\n> **Reference**: See `references\u002Fshell-and-process.md` for complete $ API, spawn options, IPC, and signal handling.\n\n## Glob Pattern Matching\n\n```typescript\nconst glob = new Bun.Glob('**\u002F*.ts')\n\n\u002F\u002F Async iteration\nfor await (const path of glob.scan({ cwd: '.\u002Fsrc', onlyFiles: true })) {\n  console.log(path)\n}\n\n\u002F\u002F Sync iteration\nfor (const path of glob.scanSync('.\u002Fsrc')) {\n  console.log(path)\n}\n\n\u002F\u002F Test if a path matches\nglob.match('src\u002Findex.ts')       \u002F\u002F true\nglob.match('README.md')          \u002F\u002F false\n\n\u002F\u002F Scan options\nglob.scan({\n  cwd: '.\u002Fsrc',                  \u002F\u002F Directory to scan (default: '.')\n  dot: false,                    \u002F\u002F Include dotfiles (default: false)\n  onlyFiles: true,               \u002F\u002F Skip directories (default: true)\n  absolute: false,               \u002F\u002F Return absolute paths (default: false)\n  followSymlinks: false,         \u002F\u002F Follow symlinks (default: false)\n})\n```\n\n## Environment and Arguments\n\n```typescript\nBun.env.NODE_ENV                 \u002F\u002F Environment variable (same as process.env)\nBun.env.DATABASE_URL             \u002F\u002F Typed access\n\nBun.argv                         \u002F\u002F string[] — [bunPath, scriptPath, ...args]\n\u002F\u002F Equivalent: process.argv\n\nBun.main                         \u002F\u002F Absolute path to the entry point script\n\nimport.meta.dir                  \u002F\u002F Directory of current file\nimport.meta.file                 \u002F\u002F Filename of current file\nimport.meta.path                 \u002F\u002F Full path of current file\nimport.meta.dirname              \u002F\u002F Same as import.meta.dir (Node.js compat)\nimport.meta.filename             \u002F\u002F Same as import.meta.path (Node.js compat)\n```\n\n## SQL Client (Bun.sql) -- PostgreSQL, MySQL, SQLite\n\nBuilt-in SQL client for querying databases via connection URL. Zero dependencies, tagged template literals, automatic prepared statements, connection pooling. **Use when the project has `DATABASE_URL` in `.env` or environment.**\n\n```typescript\nimport { sql, SQL } from \"bun\"\n\n\u002F\u002F Default instance -- auto-connects using DATABASE_URL from environment\nconst users = await sql`SELECT * FROM users WHERE active = ${true} LIMIT ${10}`\n\n\u002F\u002F Explicit connection\nconst db = new SQL(\"postgres:\u002F\u002Fuser:pass@localhost:5432\u002Fmydb\")\nconst results = await db`SELECT * FROM users`\n\n\u002F\u002F MySQL\nconst mysql = new SQL(\"mysql:\u002F\u002Fuser:pass@localhost:3306\u002Fmydb\")\n```\n\n### Insert \u002F Update with Object Helpers\n\n```typescript\nconst user = { name: \"Alice\", email: \"alice@example.com\" }\n\n\u002F\u002F Insert -- expands object to (column1, column2) VALUES (val1, val2)\nconst [newUser] = await sql`INSERT INTO users ${sql(user)} RETURNING *`\n\n\u002F\u002F Bulk insert\nawait sql`INSERT INTO users ${sql([user1, user2, user3])}`\n\n\u002F\u002F Update -- expands to SET column1 = val1, column2 = val2\nawait sql`UPDATE users SET ${sql(updates)} WHERE id = ${userId}`\n```\n\n### Transactions\n\n```typescript\nawait sql.begin(async (tx) => {\n  const [user] = await tx`INSERT INTO users (name) VALUES (${\"Alice\"}) RETURNING *`\n  await tx`INSERT INTO audit_log (action, user_id) VALUES ('created', ${user.id})`\n})\n\u002F\u002F Auto-committed on success, rolled back on error\n```\n\n> **Reference**: See `references\u002Fsql-client.md` for connection options, pool management, savepoints, MySQL specifics, and prepared statement configuration.\n\n## S3 Client (Bun.s3)\n\nBuilt-in S3 client with Web standard Blob API. Zero dependencies, works with any S3-compatible service (AWS S3, Cloudflare R2, MinIO, etc.). **Use when the project has `AWS_ACCESS_KEY_ID` or S3-compatible credentials in environment.**\n\n```typescript\nimport { s3, write } from \"bun\"\n\n\u002F\u002F Reads credentials from AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, etc.\nconst file = s3.file(\"data.json\")              \u002F\u002F Lazy reference, no network yet\n\n\u002F\u002F Read from S3\nconst data = await file.json()                  \u002F\u002F Download and parse JSON\nconst text = await file.text()                  \u002F\u002F Download as string\nconst stream = file.stream()                    \u002F\u002F ReadableStream\n\n\u002F\u002F Upload to S3\nawait write(s3.file(\"output.json\"), JSON.stringify(data))\n\n\u002F\u002F Presigned URLs (synchronous, no network request)\nconst url = s3.presign(\"report.pdf\", {\n  expiresIn: 3600,                              \u002F\u002F 1 hour\n  method: \"PUT\",                                \u002F\u002F For uploads\n  acl: \"public-read\",\n})\n\n\u002F\u002F Delete\nawait file.delete()\n```\n\n> **Reference**: See `references\u002Fs3-client.md` for custom S3Client, presign options, multipart upload, and serving from Bun.serve.\n\n## Redis Client (Bun.redis)\n\nBuilt-in Redis\u002FValkey client with zero dependencies. **Use when the project has `REDIS_URL` or `VALKEY_URL` in environment.**\n\n```typescript\nimport { redis, RedisClient } from \"bun\"\n\n\u002F\u002F Default client -- reads REDIS_URL from environment\nawait redis.set(\"key\", \"value\")\nconst value = await redis.get(\"key\")            \u002F\u002F \"value\" | null\n\n\u002F\u002F With expiration\nawait redis.set(\"session\", \"data\", \"EX\", 3600)\n\n\u002F\u002F Counter operations\nawait redis.incr(\"counter\")\nawait redis.incrby(\"counter\", 5)\n\n\u002F\u002F Hash operations\nawait redis.hset(\"user:1\", \"name\", \"Alice\", \"email\", \"alice@example.com\")\nawait redis.hget(\"user:1\", \"name\")              \u002F\u002F \"Alice\"\n\n\u002F\u002F Custom client\nconst client = new RedisClient(\"redis:\u002F\u002Fuser:pass@host:6379\")\n```\n\n> **Reference**: See `references\u002Fredis-client.md` for all commands (strings, hashes, lists, sets, sorted sets), pub\u002Fsub, pipelines, and common patterns.\n\n## Archive (Bun.Archive)\n\nCreate and extract tarballs with optional gzip compression.\n\n```typescript\n\u002F\u002F Create archive\nconst archive = new Bun.Archive({\n  \"hello.txt\": \"Hello, World!\",\n  \"config.json\": JSON.stringify({ key: \"value\" }),\n})\nawait Bun.write(\"archive.tar\", archive)\n\n\u002F\u002F With gzip compression -- write the BYTES, not the Archive (see gotcha below)\nconst compressed = new Bun.Archive(\n  { \"hello.txt\": \"Hello, World!\" },\n  { compress: \"gzip\", level: 9 }        \u002F\u002F level 1-12, default 6\n)\nawait Bun.write(\"archive.tar.gz\", await compressed.bytes())\n\n\u002F\u002F Extract (auto-detects gzip)\nconst tarball = await Bun.file(\"archive.tar.gz\").bytes()\nconst extracted = new Bun.Archive(tarball)\nawait extracted.extract(\".\u002Fout\")                   \u002F\u002F -> number of entries\nawait extracted.extract(\".\u002Fout\", { glob: [\"src\u002F**\", \"!**\u002F*.test.ts\"] })\nconst files = await extracted.files()              \u002F\u002F -> Map\u003Cstring, File>\n```\n\n**Gotcha (verified on v1.4.0 through v1.4.3):** `Bun.write(path, archive)` ignores the constructor's\n`compress` option and writes an uncompressed tar under your `.tar.gz` filename. Bun's own\ndocs show `Bun.write(path, archive)` as compressing -- it does not. Always pass\n`await archive.bytes()` (or `await archive.blob()`), which do honor `compress`\n(tracked upstream: oven-sh\u002Fbun#30234).\n\nAn `Archive` is **not iterable** -- `for (const [name, contents] of archive)` throws.\nUse `await archive.files()` for a `Map\u003Cstring, File>`, or `await archive.extract(dir)`.\n\n> **Reference**: `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Farchive.mdx`\n\n## JSONC (JSON with Comments)\n\nParse JSON with comments and trailing commas -- replaces `jsonc-parser` or `json5` packages.\n\n```typescript\nimport { JSONC } from \"bun\"\n\nconst config = JSONC.parse(`{\n  \u002F\u002F Database config\n  \"host\": \"localhost\",\n  \"port\": 5432,  \u002F\u002F default port\n}`)\n```\n\nBun automatically uses JSONC parsing for `tsconfig.json`, `jsconfig.json`, `package.json`, and `bun.lock`. `.jsonc` files can be imported directly: `import config from \".\u002Fconfig.jsonc\"`.\n\n## Additional Parsing and Utilities (v1.3+)\n\n```typescript\nimport { JSON5, JSONL, XML, TOML, markdown, cron, secrets } from \"bun\"\n\n\u002F\u002F JSON5 -- superset of JSON (comments, unquoted keys, trailing commas)\nconst config = JSON5.parse(`{ unquoted: 'value', \u002F* comment *\u002F }`)\n\n\u002F\u002F JSONL -- newline-delimited JSON\nconst records = JSONL.parse('{\"a\":1}\\n{\"a\":2}\\n')\nJSONL.parseChunk(partial)                    \u002F\u002F { values, read, done, error } for streams\n\n\u002F\u002F XML -- SIMD parser + serializer (v1.4+), replaces fast-xml-parser \u002F xml2js\nconst order = XML.parse('\u003Corder id=\"A1\">\u003Citem>Tea\u003C\u002Fitem>\u003C\u002Forder>')\n\u002F\u002F { order: { \"@id\": \"A1\", item: \"Tea\" } }   -- @attr \u002F #text convention, values are strings\nXML.parse(doc, { compact: false })           \u002F\u002F { name, attributes, children } document tree\n\n\u002F\u002F TOML -- rewritten for TOML v1.1.0; stringify() added in v1.4\nconst cfg = TOML.parse('name = \"app\"')\nTOML.stringify({ name: \"app\" })\n\n\u002F\u002F Markdown -- built-in CommonMark + GFM parser (replaces marked, remark, etc.)\nconst html = markdown.html(\"# Title\\n\\n**Bold** text.\")\nconst ansi = markdown.ansi(\"# Title\")        \u002F\u002F ANSI terminal output (v1.3.12+)\nmarkdown.react(readme)                       \u002F\u002F React elements (v1.3.12+)\nmarkdown.render(src, { heading: (c, { level }) => `\u003Ch${level}>${c}\u003C\u002Fh${level}>` })\n\n\u002F\u002F Cron -- OS-level jobs, in-process scheduler, and expression parser\nconst job = cron(\"0 9 * * 1-5\", runReport)   \u002F\u002F in-process (v1.3.12+)\nconst next = cron.parse(\"0 9 * * 1-5\")       \u002F\u002F -> Date | null  (NOT a string)\n\n\u002F\u002F Secrets -- OS credential store: Keychain \u002F libsecret \u002F Credential Manager (experimental)\nawait secrets.set({ service: \"my-cli\", name: \"token\", value: t })\nconst token = await secrets.get({ service: \"my-cli\", name: \"token\" })  \u002F\u002F string | null\n\n\u002F\u002F ANSI-aware string utilities (replace wrap-ansi, slice-ansi npm packages)\nconst coloredText = \"\\x1b[31mHello, World!\\x1b[0m\"\nBun.wrapAnsi(coloredText, 80)              \u002F\u002F Wrap to column width\nBun.sliceAnsi(coloredText, 0, 5)           \u002F\u002F Grapheme-aware slice\n```\n\n**Changed in 1.4 -- `Bun.cron` time zone.** `cron.parse()` and the in-process\n`cron(schedule, handler)` read schedules in the process's **local** time zone. Before 1.4\nthey used UTC. Pass `{ tz: \"UTC\" }` as the final argument to restore the old behavior:\n\n```typescript\ncron(\"0 9 * * *\", handler, { tz: \"UTC\" })\ncron.parse(\"0 9 * * *\", Date.now(), { tz: \"UTC\" })\n```\n\n`cron.parse()` returns a `Date`, or `null` when the expression has no match within 8 years\n(e.g. February 30th). `cron.remove(title)` takes the **string title** of an OS-level job --\nit does not accept a job handle. Stop an in-process job with `job.stop()` or `using`.\n\n**Changed in 1.4 -- stricter parsers.** `TOML.parse()` and `bunfig.toml` now throw\n`SyntaxError` on unquoted string values, missing newlines between pairs, and integers past\n`Number.MAX_SAFE_INTEGER`. `JSONC.parse()` throws `SyntaxError` on invalid input and on `\"\"`\n(it returned `{}` before). `YAML.parse()` follows YAML 1.2, so `yes`\u002F`no`\u002F`on`\u002F`off` are\nstrings, not booleans -- an `on:` key in a GitHub Actions workflow parses as `\"on\"`.\n\n> **Reference**: See `references\u002Futilities.md` for full details on all parsing and utility APIs.\n\n---\n\n## SQLite (bun:sqlite)\n\nBuilt-in SQLite3 with zero dependencies. For **embedded\u002Flocal databases** -- file-based or in-memory.\n\n```typescript\nimport { Database } from 'bun:sqlite'\n\n\u002F\u002F Open database\nconst db = new Database('mydb.sqlite')\nconst db = new Database(':memory:')      \u002F\u002F In-memory\n\n\u002F\u002F Enable WAL mode (recommended)\ndb.exec('PRAGMA journal_mode = WAL')\n\n\u002F\u002F Execute statements\ndb.exec('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)')\n\n\u002F\u002F Prepared statements\nconst insert = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)')\ninsert.run('Alice', 'alice@example.com')\n\n\u002F\u002F Query\nconst select = db.prepare('SELECT * FROM users WHERE name = ?')\nconst user = select.get('Alice')         \u002F\u002F Single row or null\nconst users = select.all('Alice')        \u002F\u002F All matching rows\n\n\u002F\u002F Named parameters\nconst stmt = db.prepare('SELECT * FROM users WHERE name = $name')\nstmt.get({ $name: 'Alice' })\n\n\u002F\u002F Transactions\nconst insertMany = db.transaction((users) => {\n  for (const user of users) {\n    insert.run(user.name, user.email)\n  }\n})\ninsertMany([\n  { name: 'Bob', email: 'bob@example.com' },\n  { name: 'Carol', email: 'carol@example.com' },\n])\n\n\u002F\u002F Close\ndb.close()\n```\n\n> **Reference**: See `references\u002Fsqlite-and-data.md` for Database constructor, Statement API, transactions, and column types.\n\n## Hashing and Passwords\n\n```typescript\n\u002F\u002F Non-cryptographic (fast, for hash tables\u002Fchecksums)\nBun.hash('input')                        \u002F\u002F number (wyhash, fastest)\nBun.hash.crc32('input')                  \u002F\u002F CRC32\n\n\u002F\u002F Cryptographic\nnew Bun.CryptoHasher('sha256').update('data').digest('hex')\n\n\u002F\u002F Password hashing (async, bcrypt by default)\nconst hash = await Bun.password.hash('password')\nconst hash = await Bun.password.hash('password', { algorithm: 'argon2id' })\nconst valid = await Bun.password.verify('password', hash)\n\n\u002F\u002F Raw Argon2 tag via node:crypto (v1.4.1+) -- interop with hashes stored as bytes, not PHC strings\nimport { argon2Sync, randomBytes } from 'node:crypto'\nargon2Sync('argon2id', { message: 'pw', nonce: randomBytes(16), parallelism: 1, tagLength: 32, memory: 65536, passes: 3 })  \u002F\u002F Buffer\n```\n\n> **Reference**: See `references\u002Fhashing.md` for all hash algorithms, CryptoHasher streaming API, and password hashing options (bcrypt vs argon2id, cost parameters).\n\n## Compression\n\n```typescript\n\u002F\u002F Gzip\nconst compressed = Bun.gzipSync(data)         \u002F\u002F Uint8Array → Uint8Array\nconst decompressed = Bun.gunzipSync(compressed)\n\n\u002F\u002F Deflate\nconst compressed = Bun.deflateSync(data)\nconst decompressed = Bun.inflateSync(compressed)\n\n\u002F\u002F Zstandard (zstd)\nconst compressed = Bun.zstdCompressSync(data)\nconst decompressed = Bun.zstdDecompressSync(compressed)\n\n\u002F\u002F With options\nBun.gzipSync(data, { level: 9, memLevel: 9 })\nBun.deflateSync(data, { level: 6 })\nBun.zstdCompressSync(data, { level: 3 })\n```\n\nAll compression functions accept `Uint8Array | string | ArrayBuffer` and return `Uint8Array`.\n\nFor streams, `CompressionStream` takes a `level` as of v1.4.3 -- brotli otherwise runs at\nquality 11, which is slow for large dynamic responses. Ranges: `gzip` \u002F `deflate` \u002F\n`deflate-raw` 0-9, `brotli` 0-11, `zstd` 1-22; out of range throws `RangeError`. Bun 1.4.2\naccepts the option and ignores it.\n\n```typescript\n\u002F\u002F Inside a Bun.serve handler\nconst body = Bun.file('big.json').stream().pipeThrough(new CompressionStream('brotli', { level: 4 }))\nreturn new Response(body, { headers: { 'Content-Encoding': 'br' } })\n```\n\n## Utilities\n\n```typescript\n\u002F\u002F Which (find binary in PATH)\nBun.which('node')                        \u002F\u002F '\u002Fusr\u002Flocal\u002Fbin\u002Fnode' or null\nBun.which('bun', { PATH: '\u002Fcustom\u002Fbin' })\n\n\u002F\u002F Inspect (like console.log formatting)\nBun.inspect(obj)                         \u002F\u002F string\nBun.inspect(obj, { depth: 4, colors: true })\n\n\u002F\u002F Module resolution\nBun.resolveSync('.\u002Fmodule', '\u002Ffrom\u002Fdir')  \u002F\u002F Resolved absolute path\n\n\u002F\u002F Deep equality\nBun.deepEquals(a, b)                     \u002F\u002F boolean (structural equality)\nBun.deepEquals(a, b, true)              \u002F\u002F Strict (differentiates 0 and -0)\n\n\u002F\u002F Sleep\nawait Bun.sleep(1000)                    \u002F\u002F ms\nawait Bun.sleep(Bun.nanoseconds() + 1e9) \u002F\u002F Until timestamp\n\n\u002F\u002F Timing\nBun.nanoseconds()                        \u002F\u002F High-resolution timer (bigint)\n\n\u002F\u002F UUID\nBun.randomUUIDv7()                       \u002F\u002F Time-ordered UUID v7\n\n\u002F\u002F String width (for terminal column alignment)\nBun.stringWidth('hello')                 \u002F\u002F 5\nBun.stringWidth('你好')                  \u002F\u002F 4 (CJK double-width)\n\n\u002F\u002F Peek at a promise without awaiting\nconst value = Bun.peek(promise)          \u002F\u002F Returns value if resolved, promise if pending\n\n\u002F\u002F Color detection\nBun.color('red', 'css')                  \u002F\u002F 'rgb(255, 0, 0)'\nBun.color('#ff0000', 'ansi')             \u002F\u002F ANSI escape code\nBun.color('hsl(0, 100%, 50%)', 'number') \u002F\u002F 0xff0000\n```\n\n> **Reference**: See `references\u002Futilities.md` for complete utility function signatures and examples.\n\n## Semver (Bun.semver)\n\nBuilt-in semver operations — replaces the `semver` npm package.\n\n```typescript\n\u002F\u002F Check if a version satisfies a range\nBun.semver.satisfies('1.2.3', '^1.0.0')     \u002F\u002F true\nBun.semver.satisfies('2.0.0', '>=1.0 \u003C2.0') \u002F\u002F false\nBun.semver.satisfies('1.0.0-beta', '*')      \u002F\u002F false (pre-release excluded by default)\n\n\u002F\u002F Sort versions (returns -1, 0, or 1)\nBun.semver.order('1.0.0', '2.0.0')          \u002F\u002F -1 (a \u003C b)\nBun.semver.order('2.0.0', '1.0.0')          \u002F\u002F 1  (a > b)\nBun.semver.order('1.0.0', '1.0.0')          \u002F\u002F 0  (equal)\n\n\u002F\u002F Sort an array of versions\nconst versions = ['3.0.0', '1.2.0', '2.1.0']\nversions.sort(Bun.semver.order)              \u002F\u002F ['1.2.0', '2.1.0', '3.0.0']\n```\n\n## Serialization (bun:jsc)\n\nBinary structured clone for efficient serialization.\n\n```typescript\nimport { serialize, deserialize } from 'bun:jsc'\n\nconst data = { key: 'value', nested: [1, 2, 3] }\nconst bytes = serialize(data)              \u002F\u002F Uint8Array\nconst restored = deserialize(bytes)        \u002F\u002F Original structure\n```\n\nFaster than `JSON.stringify`\u002F`JSON.parse` for complex objects. Supports types JSON doesn't: `Date`, `RegExp`, `Map`, `Set`, `ArrayBuffer`, etc.\n\n## Image Processing (Bun.Image)\n\nBuilt-in image decode\u002Ftransform\u002Fencode (v1.3.14+) — replaces `sharp` and `jimp`.\n\n```typescript\nconst thumb = await Bun.file('upload.jpg')\n  .image()\n  .resize(400, 400, { fit: 'cover' })\n  .rotate(90).flip().flop()\n  .modulate({ brightness: 1.1 })\n  .webp({ quality: 82 })\n  .bytes()\n\nawait Bun.file('hero.jpg').image().resize(1024).webp().write('thumb.webp')\nconst { width, height, format } = await new Bun.Image(buffer).metadata()\nconst blur = await Bun.file('hero.jpg').image().placeholder()  \u002F\u002F thumbhash data URL\n\nconst pasted = Bun.Image.fromClipboard()      \u002F\u002F v1.4+, macOS\u002FWindows only, null on Linux\n```\n\n**Format support is platform-dependent** — do not assume parity:\n\n| | Linux | macOS | Windows |\n|---|---|---|---|\n| JPEG, PNG, WebP | yes | yes | yes |\n| GIF, BMP (**decode only**) | built-in | ImageIO | WIC |\n| HEIC \u002F AVIF | `ERR_IMAGE_FORMAT_UNSUPPORTED` | ImageIO (AVIF **encode** needs Apple Silicon M3+) | WIC + Microsoft Store codec (HEIF Image Extensions \u002F AV1 Video Extension) |\n| TIFF decode | no | ImageIO | WIC |\n| Clipboard | returns `null` | yes | yes |\n\nJPEG\u002FPNG\u002FWebP use statically-linked codecs, so their encoded output is byte-identical across\nplatforms; HEIC\u002FAVIF\u002FTIFF (and GIF\u002FBMP on macOS\u002FWindows) go through the OS backend. There\nare no `.gif()`\u002F`.bmp()`\u002F`.tiff()` encoder methods -- re-encode those decodes as\nJPEG\u002FPNG\u002FWebP. CMYK and YCCK JPEGs (print-oriented exports from Photoshop and press PDFs)\ndecode as of v1.4.2, converted to RGB so every transform and every encoder the platform\nsupports works on them; 1.4.1 and earlier rejected them with `Image: decode failed`. As of\nv1.4.3 a slightly damaged JPEG (stray bytes, missing end marker, truncated scan data) decodes\ntoo, with missing blocks in flat grey, where 1.4.2 rejected it with `ERR_IMAGE_DECODE_FAILED`.\n\n> **Reference**: See `references\u002Fimage.md`, and\n> `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fimage.mdx` for the full compatibility matrix.\n\n## Browser Automation (Bun.WebView)\n\nHeadless browser automation (v1.3.12+) — navigate, click, type, scroll, run JS, and\nscreenshot without Playwright or Puppeteer (system WebKit on macOS, or an installed\nChrome\u002FChromium\u002FEdge on macOS, Linux, and Windows). Clicks and scrolls are real user input.\n\n```typescript\nawait using view = new Bun.WebView({ width: 1280, height: 720 })\nawait view.navigate('https:\u002F\u002Fbun.sh')\nawait view.click(\"a[href='\u002Fdocs']\")\nconst title = await view.evaluate('document.title')\nawait Bun.write('page.png', await view.screenshot())   \u002F\u002F returns a Blob\nawait view.cdp('Page.captureScreenshot', {})           \u002F\u002F raw CDP escape hatch\n```\n\n> **Reference**: See `references\u002Fwebview.md`, and\n> `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fwebview.mdx` for input simulation and CDP events.\n\n## New in Bun 1.4.x\n\nCompact index — reach for these when the task fits, then read the linked doc before writing code.\nUntagged rows landed in 1.4.0.\n\n| API | Use it for | Doc (`node_modules\u002Fbun-types\u002Fdocs\u002F`) |\n|---|---|---|\n| `Bun.XML.parse()` \u002F `.stringify()` | XML without `fast-xml-parser`\u002F`xml2js`; `.xml` imports return the parsed doc | `runtime\u002Fxml.mdx` |\n| `Bun.TOML.stringify()` | Writing TOML (parser now TOML v1.1.0 conformant) | `runtime\u002Ftoml.mdx` |\n| `Bun.secrets` | Storing credentials in the OS keychain instead of a dotfile (experimental) | `runtime\u002Fsecrets.mdx` |\n| `Bun.spawn({ cgroup })` | Capping a child's memory\u002FPIDs on Linux before it starts | `runtime\u002Fchild-process.mdx` |\n| `Bun.Image.fromClipboard()` | Reading an image off the system pasteboard (macOS\u002FWindows) | `runtime\u002Fimage.mdx` |\n| `res.textStream()` \u002F `req.textStream()` | Iterating a body as decoded UTF-8 strings, not bytes | no docs page -- see `bun-types\u002Ffetch.d.ts` |\n| `fetch(url, { compress: 'gzip' })` | Compressing a request body and setting `Content-Encoding` | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `routes: { '\u002Fx\u002F*': { dir: '.\u002Fpublic' } }` | Serving a directory; replaces `express.static`\u002F`sirv` | `runtime\u002Fhttp\u002Frouting.mdx` |\n| `process.on('memoryPressure', fn)` | Dropping caches when the OS reports low memory; the listener receives `'warning'` or `'critical'` | no docs page -- see `bun-types\u002Foverrides.d.ts` |\n| `Bun.isStandaloneExecutable` | Branching inside a `--compile` binary, allocation-free | `bundler\u002Fexecutables.mdx` |\n| ML-DSA \u002F ML-KEM | Post-quantum signatures and key encapsulation | `runtime\u002Fnodejs-compat.mdx` |\n| `Bun.serve({ http2: true })` (v1.4.1+) | HTTP\u002F2 and HTTP\u002F1.1 on one port; `http1: false` for HTTP\u002F2-only | `runtime\u002Fhttp\u002Fserver.mdx` |\n| `Bun.write(path, response)` streams (v1.4.1+) | Downloading to disk without buffering the body | `runtime\u002Ffile-io.mdx` |\n| `WebSocket#pause()` \u002F `resume()` \u002F `isPaused` (v1.4.1+) | Client-side backpressure toward the peer (Bun extension) | no docs page -- see `bun-types\u002Fbun.d.ts` |\n| `crypto.argon2Sync()` \u002F callback `argon2()` (v1.4.1+) | Raw Argon2 tags matching Node byte-for-byte; `Bun.password` for PHC strings | `runtime\u002Fnodejs-compat.mdx` |\n| `fetch(url, { unix })` keep-alive (v1.4.1+) | Reused Unix-socket connections; `tls: { ca }` honored | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `binaryType: \"blob\"` on `ServerWebSocket` (v1.4.1+) | Receiving binary frames as `Blob`, as the client does | `runtime\u002Fhttp\u002Fwebsockets.mdx` |\n| `import x from \".\u002Ff\" with { type: \"text\" }` typed (v1.4.1+) | Loader-typed imports on TypeScript 7.1+ (`text`, `file`, `md`, `markdown`, `toml`, `yaml`, `jsonc`, `json5`, `xml`, `sqlite`, `html`) | `bun-types\u002Fts7.1\u002Fimport-attributes.d.ts` |\n| `Bun.FetchSession` (v1.4.3+) | Per-client TLS, proxy, and keep-alive settings with a private pool; replaces `undici` `Agent` \u002F `dispatcher` | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `fetch(url, { proxy: false })`, `respectNoProxy` (v1.4.3+) | Skipping the proxy environment for one request, or ignoring `NO_PROXY` for an explicit proxy | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `Bun.ModuleGraph` (v1.4.3+, experimental) | Many instances of one app in one process, each with fresh module state and its own timers and I\u002FO; not a sandbox | `runtime\u002Fmodule-graph.mdx` |\n| `--disallow-code-generation-from-strings[=strict]` (v1.4.3+) | Making `eval()` \u002F `new Function()` -- and with `=strict`, `node:vm` and `data:` imports -- throw `EvalError` | `runtime\u002Fcode-generation-from-strings.mdx` |\n| `new CompressionStream(format, { level })` (v1.4.3+) | Trading ratio for speed on streamed bodies | no docs page -- see `bun-types\u002Fglobals.d.ts` |\n| `If-Range` in `Bun.serve` (v1.4.3+) | Resumable downloads that restart in full when the file changed | `runtime\u002Fhttp\u002Frouting.mdx` |\n| `Bun.secrets.set({ persist: \"local\" })` (v1.4.3+) | Keeping a Windows credential on this machine instead of roaming with the account | `runtime\u002Fsecrets.mdx` |\n| `Bun.unsafe.setJITPolicy()` (v1.4.3+) | Restoring the normal JIT once a `--compile-jit-policy` executable is interactive | `bundler\u002Fexecutables.mdx` |\n\n`ReadableStream`, `WritableStream`, and `TransformStream` are native as of 1.4 and apply\nbackpressure automatically — `Bun.serve` pauses a request\u002Fresponse body when the socket\ncannot accept more, and `fetch()` pauses the socket when nothing is consuming the body.\nStreaming code that previously buffered whole payloads no longer needs hand-rolled\nthrottling, provided every stage of the pipeline honors backpressure.\n\n> **Reference**: See `references\u002Fmigration-1.4.md` for behavior that **changed** in 1.4,\n> 1.4.1, 1.4.2, and 1.4.3 (TLS verification against the URL hostname, `localhost` loopback\n> resolution, `ws` `ArrayBuffer` frames, `.json()` error messages, a TLS connection per\n> request-level `checkServerIdentity`, unhandled `fetch()` rejections, and the regressions each\n> patch fixed) -- the one thing Bun's shipped docs do not cover, since they describe only the\n> current state.\n\n## Script Patterns\n\n### CLI Script Template\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv bun\n\nconst args = Bun.argv.slice(2)\nconst command = args[0]\n\nswitch (command) {\n  case 'generate':\n    await generate(args.slice(1))\n    break\n  case 'process':\n    await process(args.slice(1))\n    break\n  default:\n    console.log('Usage: script \u003Cgenerate|process> [args]')\n    process.exit(1)\n}\n```\n\n### File Generator\n\n```typescript\nconst glob = new Bun.Glob('**\u002F*.schema.json')\n\nfor await (const path of glob.scan('.\u002Fschemas')) {\n  const schema = await Bun.file(`.\u002Fschemas\u002F${path}`).json()\n  const code = generateTypeScript(schema)\n  const outPath = path.replace('.schema.json', '.ts')\n  await Bun.write(`.\u002Fgenerated\u002F${outPath}`, code)\n}\n```\n\n### Data Pipeline\n\n```typescript\nimport { $ } from 'bun'\nimport { Database } from 'bun:sqlite'\n\n\u002F\u002F Fetch data\nconst data = await $`curl -s https:\u002F\u002Fapi.example.com\u002Fdata`.json()\n\n\u002F\u002F Process and store\nconst db = new Database('output.sqlite')\ndb.exec('CREATE TABLE IF NOT EXISTS items (id TEXT PRIMARY KEY, value TEXT)')\n\nconst insert = db.prepare('INSERT OR REPLACE INTO items (id, value) VALUES (?, ?)')\nconst batch = db.transaction((items) => {\n  for (const item of items) {\n    insert.run(item.id, JSON.stringify(item))\n  }\n})\n\nbatch(data.items)\ndb.close()\n```\n\n### Best Practices\n\n1. **Prefer `Bun.file()` + `Bun.write()`** over `fs.readFile`\u002F`fs.writeFile`\n2. **Use `Bun.$`** for shell commands instead of `child_process`\n3. **Use `Bun.sql()`** for PostgreSQL\u002FMySQL when `DATABASE_URL` is available -- zero-dependency, connection pooling, tagged templates\n4. **Use `bun:sqlite`** for embedded\u002Flocal SQLite databases instead of external packages\n5. **Use `Bun.Glob`** instead of `glob` npm package\n6. **Use `Bun.CryptoHasher`** instead of `crypto.createHash`\n7. **Use `Bun.password`** instead of `bcrypt`\u002F`argon2` npm packages\n8. **Use `Bun.gzipSync`\u002F`Bun.zstdCompressSync`** instead of `zlib`\n9. **Use `Bun.env`** for environment variables (same as `process.env` but typed)\n10. **Use `import.meta.dir`** instead of `__dirname` (or `import.meta.dirname` for Node compat)\n11. **Use `Bun.which()`** instead of `which` npm package\n12. **Use `Bun.s3`** instead of `@aws-sdk\u002Fclient-s3` for S3 operations\n13. **Use `Bun.redis`** instead of `ioredis` or `redis` npm packages\n14. **Use `Bun.Archive`** instead of `tar` or `archiver` npm packages for tarballs\n15. **Use `JSONC.parse()`** instead of `jsonc-parser` package\n16. **Use `JSON5.parse()`** instead of `json5` package\n17. **Use `JSONL.parse()`** instead of manual newline splitting for JSON Lines\n18. **Use `markdown.html()`\u002F`markdown.ansi()`** instead of `marked`, `remark`, or `markdown-it` packages\n19. **Use `Bun.wrapAnsi()`** instead of `wrap-ansi` npm package\n20. **Use `Bun.sliceAnsi()`** instead of `slice-ansi` npm package\n21. **Use `Bun.Image`** instead of `sharp` or `jimp` for image processing\n22. **Use `Bun.XML`** instead of `fast-xml-parser` or `xml2js` (v1.4+)\n23. **Use `Bun.secrets`** instead of writing credentials to a dotfile (v1.4+)\n24. **Use `Bun.Terminal`** instead of `node-pty` for pseudo-terminals\n25. **Use `URLPattern`** instead of `path-to-regexp`\n26. **Use `CompressionStream`\u002F`DecompressionStream`** for streaming compression -- with a `level` for brotli on hot paths (v1.4.3+)\n27. **Read `node_modules\u002Fbun-types\u002Fdocs\u002F**\u002F*.mdx`** before writing non-trivial Bun code --\n    open by explicit path, and never edit anything under `node_modules\u002F`\n28. **Use `Bun.FetchSession`** for per-client TLS, proxy, or keep-alive settings instead of an\n    `undici` `Agent` \u002F `dispatcher`, which Bun's `fetch()` ignores (v1.4.3+)\n29. **Depend on `bun-types`** (pinned to `bun --version`), not `@types\u002Fbun`, which trails every\n    release -- see \"Read Bun's Own Docs First\"\n\n## References\n\n> - `references\u002Fmigration-1.4.md` -- what changed from 1.3 through 1.4.3 (breaking behavior)\n> - `references\u002Fhttp-server.md` -- `Bun.serve` routes, TLS, WebSockets, static files\n> - `references\u002Ffile-io.md`, `references\u002Fshell-and-process.md`, `references\u002Fnetworking.md`\n> - `references\u002Fsql-client.md`, `references\u002Fsqlite-and-data.md`, `references\u002Fredis-client.md`, `references\u002Fs3-client.md`\n> - `references\u002Futilities.md`, `references\u002Fhashing.md`, `references\u002Fimage.md`, `references\u002Fwebview.md`\n","# Bun Runtime API\n\nBun runs TypeScript natively — no `tsc` compilation, no `ts-node`, no build step. Run any `.ts` file directly with `bun file.ts`; running never type checks, so use `bun check` (v1.4.3+, see the `bun-cli` skill) for that. Use Bun's native APIs instead of Node.js equivalents — they're faster, more ergonomic, and require no additional dependencies.\n\n**Critical**: In a Bun project (has `bun.lock`, `bun.lockb`, `bunfig.toml`, or `bun-types` \u002F `@types\u002Fbun` in devDependencies), always use Bun to run scripts (`bun file.ts`, not `node file.ts`) and prefer Bun-native APIs over Node.js equivalents. Mixing runtimes causes subtle bugs and unnecessary retries.\n\n**Verified against Bun v1.4.3** (2026-10-10). Features are tagged with the version that\nintroduced them (`v1.4+`, `v1.4.1+`, `v1.4.2+`, `v1.4.3+`). Where a release changed existing\nbehavior, both behaviors are stated so this skill stays correct on older projects -- check\n`bun --version` before relying on a version-tagged item.\n\n## Read Bun's Own Docs First\n\nBun ships its complete documentation inside `bun-types`, version-matched to the runtime.\nIn any project with `bun-types` or `@types\u002Fbun` installed:\n\n```text\nnode_modules\u002Fbun-types\u002Fdocs\u002F**\u002F*.mdx   # full docs, plus ~180 task-shaped guides\u002F\nnode_modules\u002Fbun-types\u002F*.d.ts          # richest API surface (bun.d.ts, serve.d.ts, sql.d.ts)\nnode_modules\u002Fbun-types\u002FCLAUDE.md       # Bun's own agent rules\n```\n\n**Consult them before writing non-trivial Bun code.** This skill covers which API to reach\nfor; the shipped docs cover exact signatures and options.\n\n1. **Depend on `bun-types`, not `@types\u002Fbun`.** `bun-types` ships with every Bun release and\n   carries both the docs and the types. `@types\u002Fbun` lags every release, often by a day or\n   more, yet `bun init` adds it as `latest`, so the newest APIs fail type checking (`TS2339`,\n   `TS2353`). Adding `bun-types` beside `@types\u002Fbun` fixes only the docs path -- type checking\n   keeps `@types\u002Fbun`'s nested, pinned copy. Switch both, then compare `bun --version` with\n   `node_modules\u002Fbun-types\u002Fpackage.json`:\n\n   ```bash\n   bun remove @types\u002Fbun\n   bun add -d bun-types@$(bun --version)   # then \"types\": [\"bun-types\"] in tsconfig.json\n   ```\n2. **Open by explicit path.** With Bun's global virtual store enabled, `node_modules\u002Fbun-types`\n   is a symlink: `find node_modules -name '*.mdx'` and `rg \u003Cpattern> node_modules` return\n   nothing, while `find node_modules\u002Fbun-types\u002Fdocs -name '*.mdx'` works.\n3. **Never edit files under `node_modules\u002F`.** Under the global store, every project on the\n   machine shares the same inode -- a write there hits all of them. Use `bun patch`.\n4. **Not installed?** The same path works online: `docs\u002Fruntime\u002Fsql.mdx` is\n   `https:\u002F\u002Fbun.com\u002Fdocs\u002Fruntime\u002Fsql`.\n\n| Task | Doc path (under `node_modules\u002Fbun-types\u002Fdocs\u002F`) |\n|---|---|\n| HTTP server, routes, WebSockets | `runtime\u002Fhttp\u002Fserver.mdx`, `runtime\u002Fhttp\u002Frouting.mdx`, `runtime\u002Fhttp\u002Fwebsockets.mdx` |\n| `fetch`, TCP, UDP, DNS | `runtime\u002Fnetworking\u002Ffetch.mdx`, `runtime\u002Fnetworking\u002Ftcp.mdx`, `runtime\u002Fnetworking\u002Fudp.mdx`, `runtime\u002Fnetworking\u002Fdns.mdx` |\n| File I\u002FO, streams, binary data | `runtime\u002Ffile-io.mdx`, `runtime\u002Fstreams.mdx`, `runtime\u002Fbinary-data.mdx` |\n| Shell, subprocesses, PTY | `runtime\u002Fshell.mdx`, `runtime\u002Fchild-process.mdx` |\n| SQL, SQLite, Redis, S3 | `runtime\u002Fsql.mdx`, `runtime\u002Fsqlite.mdx`, `runtime\u002Fredis.mdx`, `runtime\u002Fs3.mdx` |\n| Parsers | `runtime\u002Fjson5.mdx`, `runtime\u002Fjsonl.mdx`, `runtime\u002Fxml.mdx`, `runtime\u002Ftoml.mdx`, `runtime\u002Fyaml.mdx`, `runtime\u002Fmarkdown.mdx`, `runtime\u002Ffile-types.mdx` |\n| Images, WebView, cron, secrets, archives | `runtime\u002Fimage.mdx`, `runtime\u002Fwebview.mdx`, `runtime\u002Fcron.mdx`, `runtime\u002Fsecrets.mdx`, `runtime\u002Farchive.mdx` |\n| Hashing, utils, semver, glob, cookies, CSRF | `runtime\u002Fhashing.mdx`, `runtime\u002Futils.mdx`, `runtime\u002Fsemver.mdx`, `runtime\u002Fglob.mdx`, `runtime\u002Fcookies.mdx`, `runtime\u002Fcsrf.mdx` |\n| App instances, string-eval lockdown (v1.4.3+) | `runtime\u002Fmodule-graph.mdx`, `runtime\u002Fcode-generation-from-strings.mdx` |\n| Node.js compatibility | `runtime\u002Fnodejs-compat.mdx` |\n\n## When to Use\n\n- Scripts for generating files, parsing data, running migrations\n- File processing and transformation pipelines\n- Shell scripting and automation\n- Database operations with SQLite (`bun:sqlite`)\n- **Database queries via connection URL** -- project has `DATABASE_URL` in `.env` or environment (PostgreSQL, MySQL, SQLite via `Bun.sql()`)\n- **S3 storage operations** -- project has `AWS_ACCESS_KEY_ID` or uses S3-compatible storage (`Bun.s3`)\n- **Redis\u002FValkey caching and pub\u002Fsub** -- project has `REDIS_URL` or `VALKEY_URL` (`Bun.redis`)\n- Any scripting task in a Bun project\n\n## HTTP Server (Bun.serve)\n\nBuilt-in HTTP server — replaces Express, Fastify, or `http.createServer`.\n\nPrefer `routes` over hand-rolled `URL` parsing -- it gives you params, per-method handlers,\nand zero-allocation static responses. `fetch` is the fallback for unmatched requests.\n\n```typescript\nconst server = Bun.serve({\n  port: 3000,\n\n  routes: {\n    '\u002Fhealth': new Response('OK'),                    \u002F\u002F static, zero-allocation\n    '\u002Fapi\u002Fusers\u002F:id': req => Response.json({ id: req.params.id }),\n    '\u002Fapi\u002Fposts': {                                   \u002F\u002F per-method handlers\n      GET: () => Response.json(listPosts()),\n      POST: async req => Response.json(await req.json()),\n    },\n    '\u002Fstatic\u002F*': { dir: '.\u002Fpublic' },                 \u002F\u002F serve a directory (v1.4+)\n  },\n\n  fetch(req: Request): Response | Promise\u003CResponse> {  \u002F\u002F unmatched requests\n    return new Response('Not Found', { status: 404 })\n  },\n\n  error(error: Error): Response {\n    return new Response(`Error: ${error.message}`, { status: 500 })\n  },\n})\n\nconsole.log(`Listening on ${server.url}`)\n```\n\nRoute precedence: exact > `:param` > `*` > global `\u002F*`. A registered `'\u002F*'` route catches\nevery unmatched path, so `fetch` only runs when no `'\u002F*'` route exists -- use one or the\nother as the fallback, not both. Handlers receive a `BunRequest` (a `Request` plus `params`\nand `cookies`).\n\nKey methods: `server.stop()`, `server.reload()` (hot-swap handler), `server.requestIP(req)`, `server.upgrade(req)` (WebSocket).\n\n**HTTP\u002F2 (v1.4.1+, experimental).** `http2: true` serves HTTP\u002F2 and HTTP\u002F1.1 on one port with\nthe same `routes` and `fetch`: ALPN picks the protocol over TLS, and a cleartext connection\nthat opens with the HTTP\u002F2 preface (`curl --http2-prior-knowledge`, `node:http2`) gets HTTP\u002F2.\n`http1: false` refuses HTTP\u002F1.x clients. `server.upgrade()` (WebSockets) and response\ntrailers are HTTP\u002F1.1-only, so gRPC does not work over it yet.\n\n**File responses resume safely (v1.4.3+).** `Bun.file()` bodies and `{ dir }` routes already\nanswer `Range` with `206`; they now also honor `If-Range`. The range is sent only when\n`If-Range` matches the `Last-Modified` date or a strong `ETag` the response carries (Bun sets\nnone on a `Bun.file()` response -- add your own), and any other `If-Range` value gets the full\n`200`. A `{ dir }` route's weak `ETag` never matches. Bun 1.4.2 ignored `If-Range` and always\nsent the range.\n\n> **Reference**: See `references\u002Fhttp-server.md` for TLS, WebSocket upgrade, streaming\n> responses, static file serving, and 1.4 behavior changes. Full API in\n> `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fhttp\u002Fserver.mdx` and `runtime\u002Fhttp\u002Frouting.mdx`.\n\n## TCP \u002F UDP Sockets\n\nRaw sockets for non-HTTP protocols -- `Bun.listen()` \u002F `Bun.connect()` for TCP, `Bun.udpSocket()` for UDP, plus the built-in `WebSocket` client and `fetch()`.\n\n```typescript\nconst server = Bun.listen({\n  hostname: '127.0.0.1',\n  port: 8080,\n  socket: {\n    open(socket) { socket.write('welcome\\n') },\n    data(socket, data) { \u002F* Buffer *\u002F },\n  },\n})\n```\n\n> **Reference**: See `references\u002Fnetworking.md` for TCP\u002FUDP handlers, Unix sockets, the WebSocket client (`ws+unix:\u002F\u002F`), and `fetch()` transport options (HTTP\u002F2, HTTP\u002F3, proxies, system CA).\n\n## fetch() Sessions and Proxies (v1.4.3+)\n\n`Bun.FetchSession` gives a group of requests their own TLS, proxy, and keep-alive settings and a\nprivate connection pool. Reach for it instead of an `undici` `Agent` \u002F `dispatcher`: Bun's\nbuilt-in `undici` exports those classes so imports succeed, but `fetch()` ignores `dispatcher`.\n\n```typescript\nconst session = new Bun.FetchSession({\n  tls: { ca: await Bun.file('corp-ca.pem').text() },\n  proxy: { url: 'http:\u002F\u002Fproxy.internal:8080' },\n  keepAlive: { idleTimeout: 30, maxIdleSockets: 8 },   \u002F\u002F false: a new connection per request\n})\n\nconst client = new SomeClient({ fetch: session.fetch }) \u002F\u002F bound -- hand it to any client\nawait fetch('https:\u002F\u002Fapi.example.com\u002Fv1', { session })  \u002F\u002F the same, through the global fetch\nsession.close()                                         \u002F\u002F closes idle connections; stays usable\n```\n\n- Sessions never share a connection with each other or with plain `fetch()`. Request options\n  override the session's, and a request's `tls` replaces the session's `tls` as a whole.\n- **Pin certificates on the session, not the request.** A per-request\n  `tls.checkServerIdentity` opens a dedicated TLS connection and closes it after the response\n  (3 requests: 3 handshakes; 1.4.2 reused one). On a session it runs once per connection, which\n  is then pooled.\n- `session.fetch` has no `preconnect`; where an option is typed `typeof fetch`, pass\n  `session.fetch as typeof fetch`.\n\n**Proxy selection.** `proxy: false` connects directly whatever `HTTP_PROXY` \u002F `HTTPS_PROXY` \u002F\n`ALL_PROXY` say. `ALL_PROXY` now applies when the scheme-specific variable is unset (1.4.2\nignored it). `NO_PROXY` accepts `*.example.com`, CIDR blocks (`10.0.0.0\u002F8`), bare IPv6, and\n`host:port`, and also bypasses an explicit `proxy` unless that sets `respectNoProxy: false`. A\nproxy that refuses `CONNECT` makes `fetch()` reject with `ERR_PROXY_TUNNEL` -- 1.4.2 resolved\nwith the proxy's reply as if the origin had sent it:\n\n```typescript\ntry {\n  await fetch(url, { proxy: { url: 'http:\u002F\u002Fproxy.internal:8080', respectNoProxy: false } })\n} catch (e: any) {\n  if (e.code === 'ERR_PROXY_TUNNEL') console.error(e.status, e.headers.get('proxy-authenticate'))\n}\n```\n\n> **Reference**: See `references\u002Fnetworking.md` for session options, the `NO_PROXY` syntax, and\n> `checkServerIdentity` rules; `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fnetworking\u002Ffetch.mdx`.\n\n## File I\u002FO\n\n### Reading Files\n\n```typescript\n\u002F\u002F Create a BunFile reference (lazy, no read yet)\nconst file = Bun.file('path\u002Fto\u002Ffile.txt')\n\n\u002F\u002F Read contents\nconst text = await file.text()           \u002F\u002F string\nconst json = await file.json()           \u002F\u002F parsed JSON\nconst bytes = await file.arrayBuffer()   \u002F\u002F ArrayBuffer\nconst stream = file.stream()             \u002F\u002F ReadableStream\nconst blob = await file.blob()           \u002F\u002F Blob\n\n\u002F\u002F File metadata\nfile.size                                \u002F\u002F Size in bytes\nfile.type                                \u002F\u002F MIME type (auto-detected)\nfile.name                                \u002F\u002F File path\nawait file.exists()                      \u002F\u002F Boolean\n\n\u002F\u002F Read from URL\nconst remote = Bun.file('https:\u002F\u002Fexample.com\u002Fdata.json')\n```\n\n### Writing Files\n\n```typescript\n\u002F\u002F Write string\nawait Bun.write('output.txt', 'content')\n\n\u002F\u002F Write from BunFile (efficient copy)\nawait Bun.write('copy.txt', Bun.file('original.txt'))\n\n\u002F\u002F Write JSON\nawait Bun.write('data.json', JSON.stringify(data, null, 2))\n\n\u002F\u002F Write Uint8Array \u002F ArrayBuffer\nawait Bun.write('binary.dat', new Uint8Array([1, 2, 3]))\n\n\u002F\u002F Write a Response body -- streamed to disk (v1.4.1+; the whole body was buffered before)\nawait Bun.write('page.html', await fetch('https:\u002F\u002Fexample.com'))\n\n\u002F\u002F Write to stdout\nawait Bun.write(Bun.stdout, 'Hello\\n')\n```\n\n### Stdio\n\n```typescript\nBun.stdin    \u002F\u002F BunFile for stdin\nBun.stdout   \u002F\u002F BunFile for stdout\nBun.stderr   \u002F\u002F BunFile for stderr\n\n\u002F\u002F Read all of stdin\nconst input = await Bun.stdin.text()\n\n\u002F\u002F Stream stdin line by line\nfor await (const chunk of Bun.stdin.stream()) {\n  \u002F\u002F process chunk (Uint8Array)\n}\n```\n\n### Common Patterns\n\n```typescript\n\u002F\u002F JSON transform\nconst data = await Bun.file('input.json').json()\ndata.version = '2.0.0'\nawait Bun.write('output.json', JSON.stringify(data, null, 2))\n\n\u002F\u002F File generation from template\nconst template = await Bun.file('template.html').text()\nconst output = template.replace('{{title}}', 'My Page')\nawait Bun.write('index.html', output)\n\n\u002F\u002F Check if file exists before reading\nconst file = Bun.file('config.json')\nif (await file.exists()) {\n  const config = await file.json()\n}\n```\n\n> **Reference**: See `references\u002Ffile-io.md` for BunFile interface, write overloads, streaming, MIME detection, and file watching.\n\n## Shell and Process Execution\n\n### Bun.$ (Tagged Template Shell)\n\nThe primary way to run shell commands. Returns a promise with output.\n\n```typescript\nimport { $ } from 'bun'\n\n\u002F\u002F Basic execution\nconst result = await $`ls -la`\nconsole.log(result.text())          \u002F\u002F stdout as string\n\n\u002F\u002F With interpolation (auto-escaped)\nconst dir = 'my folder'\nawait $`ls ${dir}`                   \u002F\u002F Safe: \"my folder\" is properly quoted\n\n\u002F\u002F Output methods\nconst output = await $`echo hello`\noutput.text()                        \u002F\u002F \"hello\\n\"\noutput.json()                        \u002F\u002F Parse stdout as JSON\noutput.lines()                       \u002F\u002F string[] (splits on newlines)\noutput.bytes()                       \u002F\u002F Uint8Array\noutput.blob()                        \u002F\u002F Blob\noutput.exitCode                      \u002F\u002F number\noutput.stderr                        \u002F\u002F Buffer\n\n\u002F\u002F Piping\nawait $`cat file.txt | grep pattern | wc -l`\n\n\u002F\u002F Quiet mode (suppress stdout)\nawait $`npm install`.quiet()\n\n\u002F\u002F No-throw mode (don't throw on non-zero exit)\nconst result = await $`command-that-might-fail`.nothrow()\nif (result.exitCode !== 0) {\n  console.error('Failed:', result.stderr.toString())\n}\n\n\u002F\u002F Combined\nawait $`risky-command`.quiet().nothrow()\n\n\u002F\u002F Environment variables\nawait $`echo $HOME`.env({ HOME: '\u002Fcustom' })\n\n\u002F\u002F Working directory\nawait $`ls`.cwd('\u002Ftmp')\n\n\u002F\u002F Redirect to file\nawait $`echo hello > output.txt`\nawait $`cat \u003C input.txt`\n\n\u002F\u002F Pipe between commands\nconst input = Buffer.from('hello')\nawait $`cat`.stdin(input)\n```\n\n### Bun.spawn (Lower-Level)\n\nFor more control over process execution.\n\n```typescript\nconst proc = Bun.spawn(['command', 'arg1', 'arg2'], {\n  cwd: '\u002Fpath',\n  env: { ...process.env, CUSTOM: 'value' },\n  stdin: 'pipe',          \u002F\u002F 'pipe' | 'inherit' | 'ignore' | BunFile | Blob | Response\n  stdout: 'pipe',         \u002F\u002F 'pipe' | 'inherit' | 'ignore' | BunFile\n  stderr: 'pipe',         \u002F\u002F 'pipe' | 'inherit' | 'ignore' | BunFile\n  onExit(proc, exitCode, signalCode, error) {\n    \u002F\u002F Called when process exits\n  },\n})\n\n\u002F\u002F Write to stdin\nproc.stdin.write('input data')\nproc.stdin.end()\n\n\u002F\u002F Read stdout\nconst output = await new Response(proc.stdout).text()\n\n\u002F\u002F Wait for completion\nawait proc.exited                    \u002F\u002F Promise\u003Cnumber> (exit code)\n\n\u002F\u002F Kill\nproc.kill()                          \u002F\u002F SIGTERM\nproc.kill('SIGKILL')                 \u002F\u002F Specific signal\n```\n\n### Bun.spawnSync (Synchronous)\n\n```typescript\nconst result = Bun.spawnSync(['command', 'arg1'], {\n  cwd: '\u002Fpath',\n  env: { ...process.env },\n})\n\nresult.exitCode     \u002F\u002F number\nresult.stdout       \u002F\u002F Buffer\nresult.stderr       \u002F\u002F Buffer\nresult.success      \u002F\u002F boolean\n```\n\n> **Reference**: See `references\u002Fshell-and-process.md` for complete $ API, spawn options, IPC, and signal handling.\n\n## Glob Pattern Matching\n\n```typescript\nconst glob = new Bun.Glob('**\u002F*.ts')\n\n\u002F\u002F Async iteration\nfor await (const path of glob.scan({ cwd: '.\u002Fsrc', onlyFiles: true })) {\n  console.log(path)\n}\n\n\u002F\u002F Sync iteration\nfor (const path of glob.scanSync('.\u002Fsrc')) {\n  console.log(path)\n}\n\n\u002F\u002F Test if a path matches\nglob.match('src\u002Findex.ts')       \u002F\u002F true\nglob.match('README.md')          \u002F\u002F false\n\n\u002F\u002F Scan options\nglob.scan({\n  cwd: '.\u002Fsrc',                  \u002F\u002F Directory to scan (default: '.')\n  dot: false,                    \u002F\u002F Include dotfiles (default: false)\n  onlyFiles: true,               \u002F\u002F Skip directories (default: true)\n  absolute: false,               \u002F\u002F Return absolute paths (default: false)\n  followSymlinks: false,         \u002F\u002F Follow symlinks (default: false)\n})\n```\n\n## Environment and Arguments\n\n```typescript\nBun.env.NODE_ENV                 \u002F\u002F Environment variable (same as process.env)\nBun.env.DATABASE_URL             \u002F\u002F Typed access\n\nBun.argv                         \u002F\u002F string[] — [bunPath, scriptPath, ...args]\n\u002F\u002F Equivalent: process.argv\n\nBun.main                         \u002F\u002F Absolute path to the entry point script\n\nimport.meta.dir                  \u002F\u002F Directory of current file\nimport.meta.file                 \u002F\u002F Filename of current file\nimport.meta.path                 \u002F\u002F Full path of current file\nimport.meta.dirname              \u002F\u002F Same as import.meta.dir (Node.js compat)\nimport.meta.filename             \u002F\u002F Same as import.meta.path (Node.js compat)\n```\n\n## SQL Client (Bun.sql) -- PostgreSQL, MySQL, SQLite\n\nBuilt-in SQL client for querying databases via connection URL. Zero dependencies, tagged template literals, automatic prepared statements, connection pooling. **Use when the project has `DATABASE_URL` in `.env` or environment.**\n\n```typescript\nimport { sql, SQL } from \"bun\"\n\n\u002F\u002F Default instance -- auto-connects using DATABASE_URL from environment\nconst users = await sql`SELECT * FROM users WHERE active = ${true} LIMIT ${10}`\n\n\u002F\u002F Explicit connection\nconst db = new SQL(\"postgres:\u002F\u002Fuser:pass@localhost:5432\u002Fmydb\")\nconst results = await db`SELECT * FROM users`\n\n\u002F\u002F MySQL\nconst mysql = new SQL(\"mysql:\u002F\u002Fuser:pass@localhost:3306\u002Fmydb\")\n```\n\n### Insert \u002F Update with Object Helpers\n\n```typescript\nconst user = { name: \"Alice\", email: \"alice@example.com\" }\n\n\u002F\u002F Insert -- expands object to (column1, column2) VALUES (val1, val2)\nconst [newUser] = await sql`INSERT INTO users ${sql(user)} RETURNING *`\n\n\u002F\u002F Bulk insert\nawait sql`INSERT INTO users ${sql([user1, user2, user3])}`\n\n\u002F\u002F Update -- expands to SET column1 = val1, column2 = val2\nawait sql`UPDATE users SET ${sql(updates)} WHERE id = ${userId}`\n```\n\n### Transactions\n\n```typescript\nawait sql.begin(async (tx) => {\n  const [user] = await tx`INSERT INTO users (name) VALUES (${\"Alice\"}) RETURNING *`\n  await tx`INSERT INTO audit_log (action, user_id) VALUES ('created', ${user.id})`\n})\n\u002F\u002F Auto-committed on success, rolled back on error\n```\n\n> **Reference**: See `references\u002Fsql-client.md` for connection options, pool management, savepoints, MySQL specifics, and prepared statement configuration.\n\n## S3 Client (Bun.s3)\n\nBuilt-in S3 client with Web standard Blob API. Zero dependencies, works with any S3-compatible service (AWS S3, Cloudflare R2, MinIO, etc.). **Use when the project has `AWS_ACCESS_KEY_ID` or S3-compatible credentials in environment.**\n\n```typescript\nimport { s3, write } from \"bun\"\n\n\u002F\u002F Reads credentials from AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, etc.\nconst file = s3.file(\"data.json\")              \u002F\u002F Lazy reference, no network yet\n\n\u002F\u002F Read from S3\nconst data = await file.json()                  \u002F\u002F Download and parse JSON\nconst text = await file.text()                  \u002F\u002F Download as string\nconst stream = file.stream()                    \u002F\u002F ReadableStream\n\n\u002F\u002F Upload to S3\nawait write(s3.file(\"output.json\"), JSON.stringify(data))\n\n\u002F\u002F Presigned URLs (synchronous, no network request)\nconst url = s3.presign(\"report.pdf\", {\n  expiresIn: 3600,                              \u002F\u002F 1 hour\n  method: \"PUT\",                                \u002F\u002F For uploads\n  acl: \"public-read\",\n})\n\n\u002F\u002F Delete\nawait file.delete()\n```\n\n> **Reference**: See `references\u002Fs3-client.md` for custom S3Client, presign options, multipart upload, and serving from Bun.serve.\n\n## Redis Client (Bun.redis)\n\nBuilt-in Redis\u002FValkey client with zero dependencies. **Use when the project has `REDIS_URL` or `VALKEY_URL` in environment.**\n\n```typescript\nimport { redis, RedisClient } from \"bun\"\n\n\u002F\u002F Default client -- reads REDIS_URL from environment\nawait redis.set(\"key\", \"value\")\nconst value = await redis.get(\"key\")            \u002F\u002F \"value\" | null\n\n\u002F\u002F With expiration\nawait redis.set(\"session\", \"data\", \"EX\", 3600)\n\n\u002F\u002F Counter operations\nawait redis.incr(\"counter\")\nawait redis.incrby(\"counter\", 5)\n\n\u002F\u002F Hash operations\nawait redis.hset(\"user:1\", \"name\", \"Alice\", \"email\", \"alice@example.com\")\nawait redis.hget(\"user:1\", \"name\")              \u002F\u002F \"Alice\"\n\n\u002F\u002F Custom client\nconst client = new RedisClient(\"redis:\u002F\u002Fuser:pass@host:6379\")\n```\n\n> **Reference**: See `references\u002Fredis-client.md` for all commands (strings, hashes, lists, sets, sorted sets), pub\u002Fsub, pipelines, and common patterns.\n\n## Archive (Bun.Archive)\n\nCreate and extract tarballs with optional gzip compression.\n\n```typescript\n\u002F\u002F Create archive\nconst archive = new Bun.Archive({\n  \"hello.txt\": \"Hello, World!\",\n  \"config.json\": JSON.stringify({ key: \"value\" }),\n})\nawait Bun.write(\"archive.tar\", archive)\n\n\u002F\u002F With gzip compression -- write the BYTES, not the Archive (see gotcha below)\nconst compressed = new Bun.Archive(\n  { \"hello.txt\": \"Hello, World!\" },\n  { compress: \"gzip\", level: 9 }        \u002F\u002F level 1-12, default 6\n)\nawait Bun.write(\"archive.tar.gz\", await compressed.bytes())\n\n\u002F\u002F Extract (auto-detects gzip)\nconst tarball = await Bun.file(\"archive.tar.gz\").bytes()\nconst extracted = new Bun.Archive(tarball)\nawait extracted.extract(\".\u002Fout\")                   \u002F\u002F -> number of entries\nawait extracted.extract(\".\u002Fout\", { glob: [\"src\u002F**\", \"!**\u002F*.test.ts\"] })\nconst files = await extracted.files()              \u002F\u002F -> Map\u003Cstring, File>\n```\n\n**Gotcha (verified on v1.4.0 through v1.4.3):** `Bun.write(path, archive)` ignores the constructor's\n`compress` option and writes an uncompressed tar under your `.tar.gz` filename. Bun's own\ndocs show `Bun.write(path, archive)` as compressing -- it does not. Always pass\n`await archive.bytes()` (or `await archive.blob()`), which do honor `compress`\n(tracked upstream: oven-sh\u002Fbun#30234).\n\nAn `Archive` is **not iterable** -- `for (const [name, contents] of archive)` throws.\nUse `await archive.files()` for a `Map\u003Cstring, File>`, or `await archive.extract(dir)`.\n\n> **Reference**: `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Farchive.mdx`\n\n## JSONC (JSON with Comments)\n\nParse JSON with comments and trailing commas -- replaces `jsonc-parser` or `json5` packages.\n\n```typescript\nimport { JSONC } from \"bun\"\n\nconst config = JSONC.parse(`{\n  \u002F\u002F Database config\n  \"host\": \"localhost\",\n  \"port\": 5432,  \u002F\u002F default port\n}`)\n```\n\nBun automatically uses JSONC parsing for `tsconfig.json`, `jsconfig.json`, `package.json`, and `bun.lock`. `.jsonc` files can be imported directly: `import config from \".\u002Fconfig.jsonc\"`.\n\n## Additional Parsing and Utilities (v1.3+)\n\n```typescript\nimport { JSON5, JSONL, XML, TOML, markdown, cron, secrets } from \"bun\"\n\n\u002F\u002F JSON5 -- superset of JSON (comments, unquoted keys, trailing commas)\nconst config = JSON5.parse(`{ unquoted: 'value', \u002F* comment *\u002F }`)\n\n\u002F\u002F JSONL -- newline-delimited JSON\nconst records = JSONL.parse('{\"a\":1}\\n{\"a\":2}\\n')\nJSONL.parseChunk(partial)                    \u002F\u002F { values, read, done, error } for streams\n\n\u002F\u002F XML -- SIMD parser + serializer (v1.4+), replaces fast-xml-parser \u002F xml2js\nconst order = XML.parse('\u003Corder id=\"A1\">\u003Citem>Tea\u003C\u002Fitem>\u003C\u002Forder>')\n\u002F\u002F { order: { \"@id\": \"A1\", item: \"Tea\" } }   -- @attr \u002F #text convention, values are strings\nXML.parse(doc, { compact: false })           \u002F\u002F { name, attributes, children } document tree\n\n\u002F\u002F TOML -- rewritten for TOML v1.1.0; stringify() added in v1.4\nconst cfg = TOML.parse('name = \"app\"')\nTOML.stringify({ name: \"app\" })\n\n\u002F\u002F Markdown -- built-in CommonMark + GFM parser (replaces marked, remark, etc.)\nconst html = markdown.html(\"# Title\\n\\n**Bold** text.\")\nconst ansi = markdown.ansi(\"# Title\")        \u002F\u002F ANSI terminal output (v1.3.12+)\nmarkdown.react(readme)                       \u002F\u002F React elements (v1.3.12+)\nmarkdown.render(src, { heading: (c, { level }) => `\u003Ch${level}>${c}\u003C\u002Fh${level}>` })\n\n\u002F\u002F Cron -- OS-level jobs, in-process scheduler, and expression parser\nconst job = cron(\"0 9 * * 1-5\", runReport)   \u002F\u002F in-process (v1.3.12+)\nconst next = cron.parse(\"0 9 * * 1-5\")       \u002F\u002F -> Date | null  (NOT a string)\n\n\u002F\u002F Secrets -- OS credential store: Keychain \u002F libsecret \u002F Credential Manager (experimental)\nawait secrets.set({ service: \"my-cli\", name: \"token\", value: t })\nconst token = await secrets.get({ service: \"my-cli\", name: \"token\" })  \u002F\u002F string | null\n\n\u002F\u002F ANSI-aware string utilities (replace wrap-ansi, slice-ansi npm packages)\nconst coloredText = \"\\x1b[31mHello, World!\\x1b[0m\"\nBun.wrapAnsi(coloredText, 80)              \u002F\u002F Wrap to column width\nBun.sliceAnsi(coloredText, 0, 5)           \u002F\u002F Grapheme-aware slice\n```\n\n**Changed in 1.4 -- `Bun.cron` time zone.** `cron.parse()` and the in-process\n`cron(schedule, handler)` read schedules in the process's **local** time zone. Before 1.4\nthey used UTC. Pass `{ tz: \"UTC\" }` as the final argument to restore the old behavior:\n\n```typescript\ncron(\"0 9 * * *\", handler, { tz: \"UTC\" })\ncron.parse(\"0 9 * * *\", Date.now(), { tz: \"UTC\" })\n```\n\n`cron.parse()` returns a `Date`, or `null` when the expression has no match within 8 years\n(e.g. February 30th). `cron.remove(title)` takes the **string title** of an OS-level job --\nit does not accept a job handle. Stop an in-process job with `job.stop()` or `using`.\n\n**Changed in 1.4 -- stricter parsers.** `TOML.parse()` and `bunfig.toml` now throw\n`SyntaxError` on unquoted string values, missing newlines between pairs, and integers past\n`Number.MAX_SAFE_INTEGER`. `JSONC.parse()` throws `SyntaxError` on invalid input and on `\"\"`\n(it returned `{}` before). `YAML.parse()` follows YAML 1.2, so `yes`\u002F`no`\u002F`on`\u002F`off` are\nstrings, not booleans -- an `on:` key in a GitHub Actions workflow parses as `\"on\"`.\n\n> **Reference**: See `references\u002Futilities.md` for full details on all parsing and utility APIs.\n\n---\n\n## SQLite (bun:sqlite)\n\nBuilt-in SQLite3 with zero dependencies. For **embedded\u002Flocal databases** -- file-based or in-memory.\n\n```typescript\nimport { Database } from 'bun:sqlite'\n\n\u002F\u002F Open database\nconst db = new Database('mydb.sqlite')\nconst db = new Database(':memory:')      \u002F\u002F In-memory\n\n\u002F\u002F Enable WAL mode (recommended)\ndb.exec('PRAGMA journal_mode = WAL')\n\n\u002F\u002F Execute statements\ndb.exec('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)')\n\n\u002F\u002F Prepared statements\nconst insert = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)')\ninsert.run('Alice', 'alice@example.com')\n\n\u002F\u002F Query\nconst select = db.prepare('SELECT * FROM users WHERE name = ?')\nconst user = select.get('Alice')         \u002F\u002F Single row or null\nconst users = select.all('Alice')        \u002F\u002F All matching rows\n\n\u002F\u002F Named parameters\nconst stmt = db.prepare('SELECT * FROM users WHERE name = $name')\nstmt.get({ $name: 'Alice' })\n\n\u002F\u002F Transactions\nconst insertMany = db.transaction((users) => {\n  for (const user of users) {\n    insert.run(user.name, user.email)\n  }\n})\ninsertMany([\n  { name: 'Bob', email: 'bob@example.com' },\n  { name: 'Carol', email: 'carol@example.com' },\n])\n\n\u002F\u002F Close\ndb.close()\n```\n\n> **Reference**: See `references\u002Fsqlite-and-data.md` for Database constructor, Statement API, transactions, and column types.\n\n## Hashing and Passwords\n\n```typescript\n\u002F\u002F Non-cryptographic (fast, for hash tables\u002Fchecksums)\nBun.hash('input')                        \u002F\u002F number (wyhash, fastest)\nBun.hash.crc32('input')                  \u002F\u002F CRC32\n\n\u002F\u002F Cryptographic\nnew Bun.CryptoHasher('sha256').update('data').digest('hex')\n\n\u002F\u002F Password hashing (async, bcrypt by default)\nconst hash = await Bun.password.hash('password')\nconst hash = await Bun.password.hash('password', { algorithm: 'argon2id' })\nconst valid = await Bun.password.verify('password', hash)\n\n\u002F\u002F Raw Argon2 tag via node:crypto (v1.4.1+) -- interop with hashes stored as bytes, not PHC strings\nimport { argon2Sync, randomBytes } from 'node:crypto'\nargon2Sync('argon2id', { message: 'pw', nonce: randomBytes(16), parallelism: 1, tagLength: 32, memory: 65536, passes: 3 })  \u002F\u002F Buffer\n```\n\n> **Reference**: See `references\u002Fhashing.md` for all hash algorithms, CryptoHasher streaming API, and password hashing options (bcrypt vs argon2id, cost parameters).\n\n## Compression\n\n```typescript\n\u002F\u002F Gzip\nconst compressed = Bun.gzipSync(data)         \u002F\u002F Uint8Array → Uint8Array\nconst decompressed = Bun.gunzipSync(compressed)\n\n\u002F\u002F Deflate\nconst compressed = Bun.deflateSync(data)\nconst decompressed = Bun.inflateSync(compressed)\n\n\u002F\u002F Zstandard (zstd)\nconst compressed = Bun.zstdCompressSync(data)\nconst decompressed = Bun.zstdDecompressSync(compressed)\n\n\u002F\u002F With options\nBun.gzipSync(data, { level: 9, memLevel: 9 })\nBun.deflateSync(data, { level: 6 })\nBun.zstdCompressSync(data, { level: 3 })\n```\n\nAll compression functions accept `Uint8Array | string | ArrayBuffer` and return `Uint8Array`.\n\nFor streams, `CompressionStream` takes a `level` as of v1.4.3 -- brotli otherwise runs at\nquality 11, which is slow for large dynamic responses. Ranges: `gzip` \u002F `deflate` \u002F\n`deflate-raw` 0-9, `brotli` 0-11, `zstd` 1-22; out of range throws `RangeError`. Bun 1.4.2\naccepts the option and ignores it.\n\n```typescript\n\u002F\u002F Inside a Bun.serve handler\nconst body = Bun.file('big.json').stream().pipeThrough(new CompressionStream('brotli', { level: 4 }))\nreturn new Response(body, { headers: { 'Content-Encoding': 'br' } })\n```\n\n## Utilities\n\n```typescript\n\u002F\u002F Which (find binary in PATH)\nBun.which('node')                        \u002F\u002F '\u002Fusr\u002Flocal\u002Fbin\u002Fnode' or null\nBun.which('bun', { PATH: '\u002Fcustom\u002Fbin' })\n\n\u002F\u002F Inspect (like console.log formatting)\nBun.inspect(obj)                         \u002F\u002F string\nBun.inspect(obj, { depth: 4, colors: true })\n\n\u002F\u002F Module resolution\nBun.resolveSync('.\u002Fmodule', '\u002Ffrom\u002Fdir')  \u002F\u002F Resolved absolute path\n\n\u002F\u002F Deep equality\nBun.deepEquals(a, b)                     \u002F\u002F boolean (structural equality)\nBun.deepEquals(a, b, true)              \u002F\u002F Strict (differentiates 0 and -0)\n\n\u002F\u002F Sleep\nawait Bun.sleep(1000)                    \u002F\u002F ms\nawait Bun.sleep(Bun.nanoseconds() + 1e9) \u002F\u002F Until timestamp\n\n\u002F\u002F Timing\nBun.nanoseconds()                        \u002F\u002F High-resolution timer (bigint)\n\n\u002F\u002F UUID\nBun.randomUUIDv7()                       \u002F\u002F Time-ordered UUID v7\n\n\u002F\u002F String width (for terminal column alignment)\nBun.stringWidth('hello')                 \u002F\u002F 5\nBun.stringWidth('你好')                  \u002F\u002F 4 (CJK double-width)\n\n\u002F\u002F Peek at a promise without awaiting\nconst value = Bun.peek(promise)          \u002F\u002F Returns value if resolved, promise if pending\n\n\u002F\u002F Color detection\nBun.color('red', 'css')                  \u002F\u002F 'rgb(255, 0, 0)'\nBun.color('#ff0000', 'ansi')             \u002F\u002F ANSI escape code\nBun.color('hsl(0, 100%, 50%)', 'number') \u002F\u002F 0xff0000\n```\n\n> **Reference**: See `references\u002Futilities.md` for complete utility function signatures and examples.\n\n## Semver (Bun.semver)\n\nBuilt-in semver operations — replaces the `semver` npm package.\n\n```typescript\n\u002F\u002F Check if a version satisfies a range\nBun.semver.satisfies('1.2.3', '^1.0.0')     \u002F\u002F true\nBun.semver.satisfies('2.0.0', '>=1.0 \u003C2.0') \u002F\u002F false\nBun.semver.satisfies('1.0.0-beta', '*')      \u002F\u002F false (pre-release excluded by default)\n\n\u002F\u002F Sort versions (returns -1, 0, or 1)\nBun.semver.order('1.0.0', '2.0.0')          \u002F\u002F -1 (a \u003C b)\nBun.semver.order('2.0.0', '1.0.0')          \u002F\u002F 1  (a > b)\nBun.semver.order('1.0.0', '1.0.0')          \u002F\u002F 0  (equal)\n\n\u002F\u002F Sort an array of versions\nconst versions = ['3.0.0', '1.2.0', '2.1.0']\nversions.sort(Bun.semver.order)              \u002F\u002F ['1.2.0', '2.1.0', '3.0.0']\n```\n\n## Serialization (bun:jsc)\n\nBinary structured clone for efficient serialization.\n\n```typescript\nimport { serialize, deserialize } from 'bun:jsc'\n\nconst data = { key: 'value', nested: [1, 2, 3] }\nconst bytes = serialize(data)              \u002F\u002F Uint8Array\nconst restored = deserialize(bytes)        \u002F\u002F Original structure\n```\n\nFaster than `JSON.stringify`\u002F`JSON.parse` for complex objects. Supports types JSON doesn't: `Date`, `RegExp`, `Map`, `Set`, `ArrayBuffer`, etc.\n\n## Image Processing (Bun.Image)\n\nBuilt-in image decode\u002Ftransform\u002Fencode (v1.3.14+) — replaces `sharp` and `jimp`.\n\n```typescript\nconst thumb = await Bun.file('upload.jpg')\n  .image()\n  .resize(400, 400, { fit: 'cover' })\n  .rotate(90).flip().flop()\n  .modulate({ brightness: 1.1 })\n  .webp({ quality: 82 })\n  .bytes()\n\nawait Bun.file('hero.jpg').image().resize(1024).webp().write('thumb.webp')\nconst { width, height, format } = await new Bun.Image(buffer).metadata()\nconst blur = await Bun.file('hero.jpg').image().placeholder()  \u002F\u002F thumbhash data URL\n\nconst pasted = Bun.Image.fromClipboard()      \u002F\u002F v1.4+, macOS\u002FWindows only, null on Linux\n```\n\n**Format support is platform-dependent** — do not assume parity:\n\n| | Linux | macOS | Windows |\n|---|---|---|---|\n| JPEG, PNG, WebP | yes | yes | yes |\n| GIF, BMP (**decode only**) | built-in | ImageIO | WIC |\n| HEIC \u002F AVIF | `ERR_IMAGE_FORMAT_UNSUPPORTED` | ImageIO (AVIF **encode** needs Apple Silicon M3+) | WIC + Microsoft Store codec (HEIF Image Extensions \u002F AV1 Video Extension) |\n| TIFF decode | no | ImageIO | WIC |\n| Clipboard | returns `null` | yes | yes |\n\nJPEG\u002FPNG\u002FWebP use statically-linked codecs, so their encoded output is byte-identical across\nplatforms; HEIC\u002FAVIF\u002FTIFF (and GIF\u002FBMP on macOS\u002FWindows) go through the OS backend. There\nare no `.gif()`\u002F`.bmp()`\u002F`.tiff()` encoder methods -- re-encode those decodes as\nJPEG\u002FPNG\u002FWebP. CMYK and YCCK JPEGs (print-oriented exports from Photoshop and press PDFs)\ndecode as of v1.4.2, converted to RGB so every transform and every encoder the platform\nsupports works on them; 1.4.1 and earlier rejected them with `Image: decode failed`. As of\nv1.4.3 a slightly damaged JPEG (stray bytes, missing end marker, truncated scan data) decodes\ntoo, with missing blocks in flat grey, where 1.4.2 rejected it with `ERR_IMAGE_DECODE_FAILED`.\n\n> **Reference**: See `references\u002Fimage.md`, and\n> `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fimage.mdx` for the full compatibility matrix.\n\n## Browser Automation (Bun.WebView)\n\nHeadless browser automation (v1.3.12+) — navigate, click, type, scroll, run JS, and\nscreenshot without Playwright or Puppeteer (system WebKit on macOS, or an installed\nChrome\u002FChromium\u002FEdge on macOS, Linux, and Windows). Clicks and scrolls are real user input.\n\n```typescript\nawait using view = new Bun.WebView({ width: 1280, height: 720 })\nawait view.navigate('https:\u002F\u002Fbun.sh')\nawait view.click(\"a[href='\u002Fdocs']\")\nconst title = await view.evaluate('document.title')\nawait Bun.write('page.png', await view.screenshot())   \u002F\u002F returns a Blob\nawait view.cdp('Page.captureScreenshot', {})           \u002F\u002F raw CDP escape hatch\n```\n\n> **Reference**: See `references\u002Fwebview.md`, and\n> `node_modules\u002Fbun-types\u002Fdocs\u002Fruntime\u002Fwebview.mdx` for input simulation and CDP events.\n\n## New in Bun 1.4.x\n\nCompact index — reach for these when the task fits, then read the linked doc before writing code.\nUntagged rows landed in 1.4.0.\n\n| API | Use it for | Doc (`node_modules\u002Fbun-types\u002Fdocs\u002F`) |\n|---|---|---|\n| `Bun.XML.parse()` \u002F `.stringify()` | XML without `fast-xml-parser`\u002F`xml2js`; `.xml` imports return the parsed doc | `runtime\u002Fxml.mdx` |\n| `Bun.TOML.stringify()` | Writing TOML (parser now TOML v1.1.0 conformant) | `runtime\u002Ftoml.mdx` |\n| `Bun.secrets` | Storing credentials in the OS keychain instead of a dotfile (experimental) | `runtime\u002Fsecrets.mdx` |\n| `Bun.spawn({ cgroup })` | Capping a child's memory\u002FPIDs on Linux before it starts | `runtime\u002Fchild-process.mdx` |\n| `Bun.Image.fromClipboard()` | Reading an image off the system pasteboard (macOS\u002FWindows) | `runtime\u002Fimage.mdx` |\n| `res.textStream()` \u002F `req.textStream()` | Iterating a body as decoded UTF-8 strings, not bytes | no docs page -- see `bun-types\u002Ffetch.d.ts` |\n| `fetch(url, { compress: 'gzip' })` | Compressing a request body and setting `Content-Encoding` | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `routes: { '\u002Fx\u002F*': { dir: '.\u002Fpublic' } }` | Serving a directory; replaces `express.static`\u002F`sirv` | `runtime\u002Fhttp\u002Frouting.mdx` |\n| `process.on('memoryPressure', fn)` | Dropping caches when the OS reports low memory; the listener receives `'warning'` or `'critical'` | no docs page -- see `bun-types\u002Foverrides.d.ts` |\n| `Bun.isStandaloneExecutable` | Branching inside a `--compile` binary, allocation-free | `bundler\u002Fexecutables.mdx` |\n| ML-DSA \u002F ML-KEM | Post-quantum signatures and key encapsulation | `runtime\u002Fnodejs-compat.mdx` |\n| `Bun.serve({ http2: true })` (v1.4.1+) | HTTP\u002F2 and HTTP\u002F1.1 on one port; `http1: false` for HTTP\u002F2-only | `runtime\u002Fhttp\u002Fserver.mdx` |\n| `Bun.write(path, response)` streams (v1.4.1+) | Downloading to disk without buffering the body | `runtime\u002Ffile-io.mdx` |\n| `WebSocket#pause()` \u002F `resume()` \u002F `isPaused` (v1.4.1+) | Client-side backpressure toward the peer (Bun extension) | no docs page -- see `bun-types\u002Fbun.d.ts` |\n| `crypto.argon2Sync()` \u002F callback `argon2()` (v1.4.1+) | Raw Argon2 tags matching Node byte-for-byte; `Bun.password` for PHC strings | `runtime\u002Fnodejs-compat.mdx` |\n| `fetch(url, { unix })` keep-alive (v1.4.1+) | Reused Unix-socket connections; `tls: { ca }` honored | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `binaryType: \"blob\"` on `ServerWebSocket` (v1.4.1+) | Receiving binary frames as `Blob`, as the client does | `runtime\u002Fhttp\u002Fwebsockets.mdx` |\n| `import x from \".\u002Ff\" with { type: \"text\" }` typed (v1.4.1+) | Loader-typed imports on TypeScript 7.1+ (`text`, `file`, `md`, `markdown`, `toml`, `yaml`, `jsonc`, `json5`, `xml`, `sqlite`, `html`) | `bun-types\u002Fts7.1\u002Fimport-attributes.d.ts` |\n| `Bun.FetchSession` (v1.4.3+) | Per-client TLS, proxy, and keep-alive settings with a private pool; replaces `undici` `Agent` \u002F `dispatcher` | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `fetch(url, { proxy: false })`, `respectNoProxy` (v1.4.3+) | Skipping the proxy environment for one request, or ignoring `NO_PROXY` for an explicit proxy | `runtime\u002Fnetworking\u002Ffetch.mdx` |\n| `Bun.ModuleGraph` (v1.4.3+, experimental) | Many instances of one app in one process, each with fresh module state and its own timers and I\u002FO; not a sandbox | `runtime\u002Fmodule-graph.mdx` |\n| `--disallow-code-generation-from-strings[=strict]` (v1.4.3+) | Making `eval()` \u002F `new Function()` -- and with `=strict`, `node:vm` and `data:` imports -- throw `EvalError` | `runtime\u002Fcode-generation-from-strings.mdx` |\n| `new CompressionStream(format, { level })` (v1.4.3+) | Trading ratio for speed on streamed bodies | no docs page -- see `bun-types\u002Fglobals.d.ts` |\n| `If-Range` in `Bun.serve` (v1.4.3+) | Resumable downloads that restart in full when the file changed | `runtime\u002Fhttp\u002Frouting.mdx` |\n| `Bun.secrets.set({ persist: \"local\" })` (v1.4.3+) | Keeping a Windows credential on this machine instead of roaming with the account | `runtime\u002Fsecrets.mdx` |\n| `Bun.unsafe.setJITPolicy()` (v1.4.3+) | Restoring the normal JIT once a `--compile-jit-policy` executable is interactive | `bundler\u002Fexecutables.mdx` |\n\n`ReadableStream`, `WritableStream`, and `TransformStream` are native as of 1.4 and apply\nbackpressure automatically — `Bun.serve` pauses a request\u002Fresponse body when the socket\ncannot accept more, and `fetch()` pauses the socket when nothing is consuming the body.\nStreaming code that previously buffered whole payloads no longer needs hand-rolled\nthrottling, provided every stage of the pipeline honors backpressure.\n\n> **Reference**: See `references\u002Fmigration-1.4.md` for behavior that **changed** in 1.4,\n> 1.4.1, 1.4.2, and 1.4.3 (TLS verification against the URL hostname, `localhost` loopback\n> resolution, `ws` `ArrayBuffer` frames, `.json()` error messages, a TLS connection per\n> request-level `checkServerIdentity`, unhandled `fetch()` rejections, and the regressions each\n> patch fixed) -- the one thing Bun's shipped docs do not cover, since they describe only the\n> current state.\n\n## Script Patterns\n\n### CLI Script Template\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv bun\n\nconst args = Bun.argv.slice(2)\nconst command = args[0]\n\nswitch (command) {\n  case 'generate':\n    await generate(args.slice(1))\n    break\n  case 'process':\n    await process(args.slice(1))\n    break\n  default:\n    console.log('Usage: script \u003Cgenerate|process> [args]')\n    process.exit(1)\n}\n```\n\n### File Generator\n\n```typescript\nconst glob = new Bun.Glob('**\u002F*.schema.json')\n\nfor await (const path of glob.scan('.\u002Fschemas')) {\n  const schema = await Bun.file(`.\u002Fschemas\u002F${path}`).json()\n  const code = generateTypeScript(schema)\n  const outPath = path.replace('.schema.json', '.ts')\n  await Bun.write(`.\u002Fgenerated\u002F${outPath}`, code)\n}\n```\n\n### Data Pipeline\n\n```typescript\nimport { $ } from 'bun'\nimport { Database } from 'bun:sqlite'\n\n\u002F\u002F Fetch data\nconst data = await $`curl -s https:\u002F\u002Fapi.example.com\u002Fdata`.json()\n\n\u002F\u002F Process and store\nconst db = new Database('output.sqlite')\ndb.exec('CREATE TABLE IF NOT EXISTS items (id TEXT PRIMARY KEY, value TEXT)')\n\nconst insert = db.prepare('INSERT OR REPLACE INTO items (id, value) VALUES (?, ?)')\nconst batch = db.transaction((items) => {\n  for (const item of items) {\n    insert.run(item.id, JSON.stringify(item))\n  }\n})\n\nbatch(data.items)\ndb.close()\n```\n\n### Best Practices\n\n1. **Prefer `Bun.file()` + `Bun.write()`** over `fs.readFile`\u002F`fs.writeFile`\n2. **Use `Bun.$`** for shell commands instead of `child_process`\n3. **Use `Bun.sql()`** for PostgreSQL\u002FMySQL when `DATABASE_URL` is available -- zero-dependency, connection pooling, tagged templates\n4. **Use `bun:sqlite`** for embedded\u002Flocal SQLite databases instead of external packages\n5. **Use `Bun.Glob`** instead of `glob` npm package\n6. **Use `Bun.CryptoHasher`** instead of `crypto.createHash`\n7. **Use `Bun.password`** instead of `bcrypt`\u002F`argon2` npm packages\n8. **Use `Bun.gzipSync`\u002F`Bun.zstdCompressSync`** instead of `zlib`\n9. **Use `Bun.env`** for environment variables (same as `process.env` but typed)\n10. **Use `import.meta.dir`** instead of `__dirname` (or `import.meta.dirname` for Node compat)\n11. **Use `Bun.which()`** instead of `which` npm package\n12. **Use `Bun.s3`** instead of `@aws-sdk\u002Fclient-s3` for S3 operations\n13. **Use `Bun.redis`** instead of `ioredis` or `redis` npm packages\n14. **Use `Bun.Archive`** instead of `tar` or `archiver` npm packages for tarballs\n15. **Use `JSONC.parse()`** instead of `jsonc-parser` package\n16. **Use `JSON5.parse()`** instead of `json5` package\n17. **Use `JSONL.parse()`** instead of manual newline splitting for JSON Lines\n18. **Use `markdown.html()`\u002F`markdown.ansi()`** instead of `marked`, `remark`, or `markdown-it` packages\n19. **Use `Bun.wrapAnsi()`** instead of `wrap-ansi` npm package\n20. **Use `Bun.sliceAnsi()`** instead of `slice-ansi` npm package\n21. **Use `Bun.Image`** instead of `sharp` or `jimp` for image processing\n22. **Use `Bun.XML`** instead of `fast-xml-parser` or `xml2js` (v1.4+)\n23. **Use `Bun.secrets`** instead of writing credentials to a dotfile (v1.4+)\n24. **Use `Bun.Terminal`** instead of `node-pty` for pseudo-terminals\n25. **Use `URLPattern`** instead of `path-to-regexp`\n26. **Use `CompressionStream`\u002F`DecompressionStream`** for streaming compression -- with a `level` for brotli on hot paths (v1.4.3+)\n27. **Read `node_modules\u002Fbun-types\u002Fdocs\u002F**\u002F*.mdx`** before writing non-trivial Bun code --\n    open by explicit path, and never edit anything under `node_modules\u002F`\n28. **Use `Bun.FetchSession`** for per-client TLS, proxy, or keep-alive settings instead of an\n    `undici` `Agent` \u002F `dispatcher`, which Bun's `fetch()` ignores (v1.4.3+)\n29. **Depend on `bun-types`** (pinned to `bun --version`), not `@types\u002Fbun`, which trails every\n    release -- see \"Read Bun's Own Docs First\"\n\n## References\n\n> - `references\u002Fmigration-1.4.md` -- what changed from 1.3 through 1.4.3 (breaking behavior)\n> - `references\u002Fhttp-server.md` -- `Bun.serve` routes, TLS, WebSockets, static files\n> - `references\u002Ffile-io.md`, `references\u002Fshell-and-process.md`, `references\u002Fnetworking.md`\n> - `references\u002Fsql-client.md`, `references\u002Fsqlite-and-data.md`, `references\u002Fredis-client.md`, `references\u002Fs3-client.md`\n> - `references\u002Futilities.md`, `references\u002Fhashing.md`, `references\u002Fimage.md`, `references\u002Fwebview.md`\n",{"name":5,"description":7},"master","bfa2c1cff678afb35dca75f52f5d4c683e544c79",".otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f",0,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill","https:\u002F\u002Fgithub.com\u002Fdatamonsterr","Product Engineer","2026-11-08 16:15:51",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add datamonsterr\u002Fother-skill --skill bun-api",{"tool":39,"command":40},"bunx","bunx skills add datamonsterr\u002Fother-skill --skill bun-api",{"tool":42,"command":43},"pnpm","pnpm dlx skills add datamonsterr\u002Fother-skill --skill bun-api","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002FSKILL.md",true,[47,53,57,61,65,69,73,77,81,85,89,93,97,101,105],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},".otherskill.json","REFERENCE","参考文档",327,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002F.otherskill.json",{"path":54,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":16},"LICENSE","许可证",1036,{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Ffile-io.md",6702,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Ffile-io.md",{"path":62,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fhashing.md",8517,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fhashing.md",{"path":66,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fhttp-server.md",14835,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fhttp-server.md",{"path":70,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fimage.md",5916,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fimage.md",{"path":74,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fmigration-1.4.md",29942,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fmigration-1.4.md",{"path":78,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fnetworking.md",14062,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fnetworking.md",{"path":82,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fredis-client.md",6062,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fredis-client.md",{"path":86,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fs3-client.md",5736,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fs3-client.md",{"path":90,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fshell-and-process.md",10420,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fshell-and-process.md",{"path":94,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Fsql-client.md",9920,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fsql-client.md",{"path":98,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fsqlite-and-data.md",6708,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fsqlite-and-data.md",{"path":102,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Futilities.md",24536,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Futilities.md",{"path":106,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":107,"sourceHtmlUrl":108},"references\u002Fwebview.md",3196,"https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-api--2ed05c7ba5dd764f\u002Freferences\u002Fwebview.md",[110,119,127,135,143],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":114,"licenseFileUrl":115,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":20},"01M7D3VENJ4DW6A6SENKCE0SPS","skill-creator","Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fmanagement\u002Fskill-creator--8a7784776c1d7d1d\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fmanagement\u002Fskill-creator--8a7784776c1d7d1d\u002FSKILL.md",[],[],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":114,"licenseFileUrl":123,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":20},"01M7D3V6XQ5Q4P4A66KGA1TGFK","hook-development","This skill should be used when the user asks to \"create a hook\", \"add a PreToolUse\u002FPostToolUse\u002FStop hook\", \"validate tool use\", \"implement prompt-based hooks\", \"use ${CLAUDE_PLUGIN_ROOT}\", \"set up event-driven automation\", \"block dangerous commands\", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fmanagement\u002Fhook-development--a82eb25c70ecda8d\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fmanagement\u002Fhook-development--a82eb25c70ecda8d\u002FSKILL.md",[],[],{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":131,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":20},"01M7D3V0Q3KJ4768NKZ1BESB5W","crafting-effective-readmes","Use when writing or improving README files. Not all READMEs are the same — provides templates and guidance matched to your audience and project type.","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fdocs\u002Fcrafting-effective-readmes--d7c2c8d55c003c98\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fdocs\u002Fcrafting-effective-readmes--d7c2c8d55c003c98\u002FSKILL.md",[],[],{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":139,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":20},"01M7D3TV7ZRNA40REYM63V92MZ","openrouter","Choose OpenRouter models and routers, query live catalog data, use structured outputs and batch inference, and debug routing with metadata. Use when working with OpenRouter APIs, openrouter\u002Fauto, openrouter\u002Ffree, model discovery, pricing, providers, batch jobs, or structured JSON responses.","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fopenrouter--a3545e0ad9571eb6\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fopenrouter--a3545e0ad9571eb6\u002FSKILL.md",[],[],{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":147,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":20},"01M7D3TFM8YR2B4XQ16K0VHFKC","bun-cli","Bun CLI reference for package management, script running, type checking, testing, bundling, and compilation. Covers bun install\u002Fadd\u002Fremove\u002Fupdate, bun run, bun check and --check, bun test, bun build, bunx, bun patch, bun audit fix, bun dedupe, bun prune, bun why, bun pm, bun repl, bunfig.toml, bun.lock, workspace catalogs, isolated installs and the global virtual store, offline installs, self-contained workspaces, zero-config frontend dev, parallel\u002Fsequential execution, test sharding and parallelism, code splitting, bytecode, profile-guided bytecode layout and cross-compiled executables, compile-to-browser, and replacing npm\u002Fnpx\u002Fyarn\u002Fpnpm and tsc --noEmit with bun equivalents. Use for package management, lockfile issues, type checking, test runner config, bundler setup, or frontend dev server Not for Bun runtime APIs (Bun.file(), Bun.$(), Bun.sql()) -- use bun-api skill","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-cli--396a407bee6a948e\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdatamonsterr\u002Fother-skill\u002Fblob\u002Fmaster\u002F.otherskill\u002Fbank\u002Fbackend\u002Fbun-cli--396a407bee6a948e\u002FSKILL.md",[],[]]