MCPcopy Index your code
hub / github.com/markmap/markmap / sendStatic

Function sendStatic

packages/markmap-cli/src/util/dev-server.ts:126–137  ·  view source on GitHub ↗
(c: Context, realpath: string)

Source from the content-addressed store, hash-verified

124}
125
126async 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
139export class MarkmapDevServer {
140 providers: Record<string, IContentProvider> = {};

Callers 1

setupMethod · 0.85

Calls 1

createStreamBodyFunction · 0.90

Tested by

no test coverage detected