VideoChain-API / src /scheduler /saveCompletedTask.mts
jbilcke-hf's picture
jbilcke-hf HF staff
ok! now, time to debug and build the frontend..
5dfc565
raw
history blame
539 Bytes
import { promises as fs } from "node:fs"
import path from "path"
import { VideoTask } from "../types.mts"
import { completedTasksDirFilePath, pendingTasksDirFilePath } from "../config.mts"
import { moveFile } from "../utils/moveFile.mts"
export const saveCompletedTask = async (task: VideoTask) => {
const fileName = `${task.id}.json`
const pendingFilePath = path.join(pendingTasksDirFilePath, fileName)
const completedFilePath = path.join(completedTasksDirFilePath, fileName)
await moveFile(pendingFilePath, completedFilePath)
}