VideoChain-API / src /scheduler /savePendingTask.mts
jbilcke-hf's picture
jbilcke-hf HF staff
ready for release (sort of)
9571f2e
raw
history blame
412 Bytes
import { promises as fs } from "node:fs"
import path from "path"
import { VideoTask } from "../types.mts"
import { pendingTasksDirFilePath } from "../config.mts"
export const savePendingTask = async (task: VideoTask) => {
const fileName = `${task.ownerId}_${task.id}.json`
const filePath = path.join(pendingTasksDirFilePath, fileName)
await fs.writeFile(filePath, JSON.stringify(task, null, 2), "utf8")
}