File size: 539 Bytes
652f343
 
 
 
deae345
5dfc565
652f343
 
 
 
 
5dfc565
652f343
1
2
3
4
5
6
7
8
9
10
11
12
13
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)
}