MCPcopy Create free account
hub / github.com/TomClive/SeeDance2Stitcher / serveFile

Function serveFile

server.js:367–379  ·  view source on GitHub ↗
(res, filePath)

Source from the content-addressed store, hash-verified

365}
366
367async function serveFile(res, filePath) {
368 try {
369 const stat = await fsp.stat(filePath);
370 res.writeHead(200, {
371 "Content-Type": getMime(filePath),
372 "Content-Length": stat.size,
373 "Accept-Ranges": "bytes"
374 });
375 fs.createReadStream(filePath).pipe(res);
376 } catch {
377 text(res, 404, "Not found");
378 }
379}
380
381function readBody(req) {
382 return new Promise((resolve, reject) => {

Callers 1

handleRequestFunction · 0.85

Calls 2

getMimeFunction · 0.85
textFunction · 0.85

Tested by

no test coverage detected