(c: Context, realpath: string)
| 124 | } |
| 125 | |
| 126 | async function sendStatic(c: Context, realpath: string) { |
| 127 | try { |
| 128 | const result = await stat(realpath); |
| 129 | if (!result.isFile()) throw new Error('File not found'); |
| 130 | } catch { |
| 131 | return c.body('File not found', 404); |
| 132 | } |
| 133 | const stream = createReadStream(realpath); |
| 134 | const type = getMimeType(realpath); |
| 135 | if (type) c.header('content-type', type); |
| 136 | return c.body(createStreamBody(stream)); |
| 137 | } |
| 138 | |
| 139 | export class MarkmapDevServer { |
| 140 | providers: Record<string, IContentProvider> = {}; |
no test coverage detected