mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
The commit refactors the chunked upload system to support a transformation pipeline. Key changes include: - Replace SSE field names for consistency (sseChannelId, sseUrl) - Fix progress reporting structure with state and percent fields - Add transformation handlers (a-dash, mq-hls, img-compress, video-compress) - Create new Upload class with clear separation of concerns - Improve file processing workflow with better directory structure - Fix typo in UploadButton component (progess → progress) - Remove deprecated file processing services
30 lines
540 B
JavaScript
30 lines
540 B
JavaScript
import path from "node:path"
|
|
import fs from "node:fs"
|
|
|
|
import Upload from "@classes/Upload"
|
|
|
|
export default {
|
|
id: "file-process",
|
|
maxJobs: 2,
|
|
process: async (job) => {
|
|
console.log("[JOB][file-process] starting... >", job.data)
|
|
|
|
try {
|
|
const result = await Upload.fileHandle({
|
|
...job.data,
|
|
onProgress: (progress) => {
|
|
job.updateProgress(progress)
|
|
},
|
|
})
|
|
|
|
return result
|
|
} catch (error) {
|
|
await fs.promises
|
|
.rm(tmpPath, { recursive: true, force: true })
|
|
.catch(() => null)
|
|
|
|
throw error
|
|
}
|
|
},
|
|
}
|