( video: typeof videos.$inferSelect, rawFileKey: string, )
| 12 | import { decodeStorageVideo } from "@/lib/video-storage"; |
| 13 | |
| 14 | async 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 | |
| 33 | export async function triggerVideoProcessing({ |
| 34 | videoId, |
no test coverage detected