(file: Deno.FsFile, data: Uint8Array)
| 14 | |
| 15 | // Deno.FsFile.write() may do short writes (like POSIX write()), so loop until all bytes are written. |
| 16 | async function writeAll(file: Deno.FsFile, data: Uint8Array): Promise<void> { |
| 17 | let offset = 0; |
| 18 | while (offset < data.length) { |
| 19 | offset += await file.write(data.subarray(offset)); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | // Remove upload dirs for this user that have not been touched in over 24 hours. |
| 24 | async function cleanStaleUploads(userUploadDir: string): Promise<void> { |