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

Function verifyRawFileUploaded

apps/web/actions/video/trigger-processing.ts:14–31  ·  view source on GitHub ↗
(
	video: typeof videos.$inferSelect,
	rawFileKey: string,
)

Source from the content-addressed store, hash-verified

12import { decodeStorageVideo } from "@/lib/video-storage";
13
14async function verifyRawFileUploaded(
15 video: typeof videos.$inferSelect,
16 rawFileKey: string,
17) {
18 const [bucket] = await Storage.getAccessForVideo(
19 decodeStorageVideo(video),
20 ).pipe(runPromise);
21 const head = await bucket
22 .headObject(rawFileKey)
23 .pipe(
24 Effect.retry({ times: 3, schedule: Schedule.exponential("100 millis") }),
25 runPromise,
26 );
27
28 if ((head.ContentLength ?? 0) <= 0) {
29 throw new Error("Uploaded video file is empty");
30 }
31}
32
33export async function triggerVideoProcessing({
34 videoId,

Callers 1

triggerVideoProcessingFunction · 0.85

Calls 1

decodeStorageVideoFunction · 0.90

Tested by

no test coverage detected