MCPcopy Index your code
hub / github.com/Effect-TS/effect / fileResponse

Function fileResponse

packages/platform-node/src/internal/httpPlatform.ts:14–25  ·  view source on GitHub ↗
(path, status, statusText, headers, start, end, contentLength)

Source from the content-addressed store, hash-verified

12/** @internal */
13export const make = Platform.make({
14 fileResponse(path, status, statusText, headers, start, end, contentLength) {
15 const stream = Fs.createReadStream(path, { start, end })
16 return ServerResponse.raw(stream, {
17 headers: {
18 ...headers,
19 "content-type": headers["content-type"] ?? Mime.getType(path) ?? "application/octet-stream",
20 "content-length": contentLength.toString()
21 },
22 status,
23 statusText
24 })
25 },
26 fileWebResponse(file, status, statusText, headers, _options) {
27 return ServerResponse.raw(Readable.fromWeb(file.stream() as any), {
28 headers: Headers.merge(

Callers

nothing calls this directly

Calls 2

rawMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected