MCPcopy
hub / github.com/FoalTS/foal / createHttpResponseFile

Function createHttpResponseFile

packages/swagger/src/swagger-controller.ts:155–164  ·  view source on GitHub ↗
(filename: string, contentType: string)

Source from the content-addressed store, hash-verified

153 }
154
155 private async createHttpResponseFile(filename: string, contentType: string): Promise<HttpResponseOK> {
156 const filePath = join(getAbsoluteFSPath(), filename);
157
158 const stream = createReadStream(filePath);
159 const stats = await stat(filePath);
160
161 return new HttpResponseOK(stream, { stream: true })
162 .setHeader('Content-Type', contentType)
163 .setHeader('Content-Length', stats.size.toString());
164 }
165
166}

Callers

nothing calls this directly

Calls 1

joinFunction · 0.85

Tested by

no test coverage detected