MCPcopy Create free account
hub / github.com/Markonis/hndl / defaultFileReader

Function defaultFileReader

src/static-files.ts:75–82  ·  view source on GitHub ↗
(dynamic: boolean)

Source from the content-addressed store, hash-verified

73 readdir(dir).then((list) => new Set(list));
74
75const defaultFileReader = (dynamic: boolean): FileReader => {
76 const cache: Record<string, string | Buffer | undefined> = {};
77 return async (path) => {
78 const buffer = (!dynamic && cache[path]) || (await readFile(path));
79 cache[path] = buffer;
80 return buffer;
81 };
82};
83
84const minimalContentTypeResolver: ContentTypeResolver = (ext) => {
85 const mimeTypes = {

Callers 1

staticFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected