File size: 412 Bytes
652f343
 
 
 
deae345
652f343
 
9571f2e
652f343
 
 
1
2
3
4
5
6
7
8
9
10
11
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")
}