MCPcopy Index your code
hub / github.com/CapSoftware/Cap / createTempFile

Function createTempFile

apps/media-server/src/lib/temp-files.ts:18–33  ·  view source on GitHub ↗
(
	extension: string,
)

Source from the content-addressed store, hash-verified

16}
17
18export async function createTempFile(
19 extension: string,
20): Promise<TempFileHandle> {
21 await ensureTempDir();
22 const filename = `${randomUUID()}${extension.startsWith(".") ? extension : `.${extension}`}`;
23 const path = join(TEMP_DIR, filename);
24
25 return {
26 path,
27 cleanup: async () => {
28 try {
29 await unlink(path);
30 } catch {}
31 },
32 };
33}
34
35export async function cleanupStaleTempFiles(): Promise<number> {
36 try {

Callers 7

concatSegmentsFunction · 0.90
renderSegmentsFunction · 0.90
downloadVideoToTempFunction · 0.90
repairContainerFunction · 0.90
processVideoFunction · 0.90
generatePreviewGifFunction · 0.90

Calls 1

ensureTempDirFunction · 0.85

Tested by

no test coverage detected