sirv.d.ts 800 B

12345678910111213141516171819202122232425
  1. declare module 'sirv' {
  2. import type { Stats } from 'fs';
  3. import type { IncomingMessage, ServerResponse } from 'http';
  4. type Arrayable<T> = T | T[];
  5. export type NextHandler = () => void | Promise<void>;
  6. export type RequestHandler = (req: IncomingMessage, res: ServerResponse, next?: NextHandler) => void;
  7. export interface Options {
  8. dev?: boolean;
  9. etag?: boolean;
  10. maxAge?: number;
  11. immutable?: boolean;
  12. single?: string | boolean;
  13. ignores?: false | Arrayable<string | RegExp>;
  14. extensions?: string[];
  15. dotfiles?: boolean;
  16. brotli?: boolean;
  17. gzip?: boolean;
  18. onNoMatch?: (req: IncomingMessage, res: ServerResponse) => void;
  19. setHeaders?: (res: ServerResponse, pathname: string, stats: Stats) => void;
  20. }
  21. export default function(dir?: string, opts?: Options): RequestHandler;
  22. }