/** * Serve a static file with production-grade cache headers: * - Strong ETag (sha256, first 16 hex chars) computed once per * `(path, mtime)` and cached in-process. * - `Last-Modified` from the file's mtime. * - 304 Not Modified when `If-None-Match` matches OR * `If-Modified-Since` is at-or-after mtime (and ETag didn't mismatch). * - `Cache-Control: public, max-age=31536000, immutable` for paths * that look fingerprinted (e.g. `/_assets/foo.abc12345.js`). * - `Cache-Control: public, max-age=300, must-revalidate` for * everything else. * * Returns a `404` if the file doesn't exist. Other read errors propagate. * * @example * ```ts * import { serveFile } from '@stacksjs/storage' * import { resolve } from 'node:path' * * route.get('/assets/:path', async (req) => { * const url = new URL(req.url) * // url.pathname is e.g. /assets/app.abc12345.js * const filePath = resolve('./public', url.pathname.replace(/^\//, '')) * return serveFile(req, filePath) * }) * ``` */ export declare function serveFile(req: Request, filePath: string, options?: ServeFileOptions): Promise; /** * Optional knobs for {@link serveFile}. */ export declare interface ServeFileOptions { contentType?: string cacheControl?: string defaultMaxAge?: number etag?: boolean }