MCPcopy Create free account
hub / github.com/denoland/std / serveFile

Function serveFile

http/unstable_file_server.ts:94–111  ·  view source on GitHub ↗
(
  req: Request,
  filePath: string,
  options?: ServeFileOptions,
)

Source from the content-addressed store, hash-verified

92 * @returns A response for the request.
93 */
94export async function serveFile(
95 req: Request,
96 filePath: string,
97 options?: ServeFileOptions,
98): Promise<Response> {
99 const response = await stableServeFile(req, filePath, options);
100
101 if (options?.headers) {
102 for (const header of options.headers) {
103 const headerSplit = header.split(":");
104 const name = headerSplit[0]!;
105 const value = headerSplit.slice(1).join(":");
106 response.headers.append(name, value);
107 }
108 }
109
110 return response;
111}

Callers

nothing calls this directly

Calls 2

appendMethod · 0.80
sliceMethod · 0.45

Tested by

no test coverage detected