UNPKG

zyf-server

Version:

A modern HTTP static file server with Vue SSR directory listing, built for developers

78 lines 1.55 kB
/** * HTTP静态文件服务器核心类 * 采用现代化的TypeScript面向对象设计 */ import type { ServerConfig, DeepReadonly } from '../types'; /** * HTTP静态文件服务器 */ export declare class Server { private readonly httpServer; private readonly config; private readonly fileService; private readonly templateEngine; private readonly cacheManager; private readonly logger; /** * 构造函数 * @param config 服务器配置 */ constructor(config: ServerConfig); /** * 启动服务器 */ start(): Promise<void>; /** * 停止服务器 */ stop(): Promise<void>; /** * 处理HTTP请求 */ private handleRequest; /** * 处理请求逻辑 */ private processRequest; /** * 处理目录请求 */ private handleDirectory; /** * 处理文件请求 */ private handleFile; /** * 渲染目录列表 */ private renderDirectoryListing; /** * 解析Range头 */ private parseRangeHeader; /** * 发送404错误 */ private sendNotFound; /** * 错误处理 */ private handleError; /** * 设置错误处理器 */ private setupErrorHandlers; /** * 打开浏览器 */ private openBrowser; /** * 获取服务器配置 */ getConfig(): DeepReadonly<ServerConfig>; /** * 获取服务器状态 */ isListening(): boolean; } //# sourceMappingURL=Server.d.ts.map