MCPcopy
hub / github.com/QwikDev/qwik / openStaticFile

Function openStaticFile

packages/qwik-city/src/middleware/deno/index.ts:135–151  ·  view source on GitHub ↗
(url: URL)

Source from the content-addressed store, hash-verified

133 };
134
135 const openStaticFile = async (url: URL) => {
136 const pathname = url.pathname;
137 const fileName = pathname.slice(url.pathname.lastIndexOf('/'));
138 let filePath: string;
139 if (fileName.includes('.')) {
140 filePath = join(staticFolder, pathname);
141 } else if (opts.qwikCityPlan.trailingSlash) {
142 filePath = join(staticFolder, pathname + 'index.html');
143 } else {
144 filePath = join(staticFolder, pathname, 'index.html');
145 }
146 return {
147 filePath,
148 // @ts-ignore
149 content: await Deno.open(filePath, { read: true }),
150 };
151 };
152
153 const staticFile = async (request: Request) => {
154 try {

Callers 1

staticFileFunction · 0.70

Calls 1

joinFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…