/** * Copyright (c) 2026 AzerothJS. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import type { Handler } from './app.ts'; /** The Content-Type served for `path`, by extension (octet-stream when unknown). */ export declare function contentTypeFor(path: string): string; /** * Options for the static file server: the root it can never escape, index/extension fallbacks, * cache policy, and range support. Traversal safety is not configurable - every resolved path * is verified to stay under `root` regardless of what these say. */ export interface StaticOptions { /** * The Cache-Control header value. The default demands revalidation (correct for * unhashed files); hashed build assets should mount a second handler with * 'public, max-age=31536000, immutable'. */ cacheControl?: string; /** The file served when the path resolves to a directory (default 'index.html'). */ index?: string; /** * The wildcard param carrying the relative path (default 'path'). With no such param * (a non-wildcard route), the whole route is one fixed file - `index` is served. */ param?: string; /** * Serve dotfiles (a path segment beginning with `.`). Default `false`: a request for * `/.env`, `/.git/config`, or any hidden file is a 404. `.well-known/` is ALWAYS served * regardless (RFC 8615 reserves it as a public path for ACME, security.txt, etc.). Set * `true` only when the root deliberately contains servable hidden files. * * The rule is enforced on the RESOLVED path, not just the requested one: a filesystem * alias that spells a hidden name differently (a Windows 8.3 short name such as `ENV~1` * for `.env`, an in-root symlink) is denied the same way. */ dotfiles?: boolean; } /** * Builds the file-serving handler for `rootDir`. The root is resolved once, at boot - a * relative root binds to the process working directory at startup, not per request. */ export declare function staticFiles(rootDir: string, options?: StaticOptions): Handler;