MCPcopy Index your code
hub / github.com/simstudioai/sim / handleLocalFilePublic

Function handleLocalFilePublic

apps/sim/app/api/files/serve/[...path]/route.ts:323–345  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

321}
322
323async function handleLocalFilePublic(filename: string): Promise<NextResponse> {
324 try {
325 const filePath = await findLocalFile(filename)
326
327 if (!filePath) {
328 throw new FileNotFoundError(`File not found: ${filename}`)
329 }
330
331 const fileBuffer = await readFile(filePath)
332 const contentType = getContentType(filename)
333
334 logger.info('Public local file served', { filename, size: fileBuffer.length })
335
336 return createFileResponse({
337 buffer: fileBuffer,
338 contentType,
339 filename,
340 })
341 } catch (error) {
342 logger.error('Error reading public local file:', error)
343 throw error
344 }
345}

Callers 1

route.tsFile · 0.85

Calls 6

findLocalFileFunction · 0.90
getContentTypeFunction · 0.90
createFileResponseFunction · 0.90
readFileFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected