MCPcopy
hub / github.com/freshframework/fresh / readFile

Method readFile

packages/fresh/src/build_cache.ts:71–94  ·  view source on GitHub ↗
(pathname: string)

Source from the content-addressed store, hash-verified

69 }
70
71 async readFile(pathname: string): Promise<StaticFile | null> {
72 const { staticFiles } = this.#snapshot;
73
74 const info = staticFiles.get(pathname);
75 if (info === undefined) return null;
76
77 const filePath = path.isAbsolute(info.filePath)
78 ? info.filePath
79 : path.join(this.root, info.filePath);
80
81 const [stat, file] = await Promise.all([
82 Deno.stat(filePath),
83 Deno.open(filePath),
84 ]);
85
86 return {
87 hash: info.hash,
88 contentType: info.contentType,
89 size: stat.size,
90 readable: file.readable,
91 close: () => file.close(),
92 immutable: info.immutable,
93 };
94 }
95}
96
97export class IslandPreparer {

Callers

nothing calls this directly

Calls 4

allMethod · 0.80
openMethod · 0.80
closeMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected