File size: 636 Bytes
5dfc565
 
 
9571f2e
5dfc565
 
 
 
 
 
9571f2e
5dfc565
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import path from "node:path"
import { promises as fs } from "node:fs"

import { completedFilesDirFilePath, pendingFilesDirFilePath } from "../config.mts"

export const copyVideoFromPendingToCompleted = async (pendingFileName: string, completedFileName?: string) => {
  if (!completedFileName) {
    completedFileName = pendingFileName
  }
  const pendingFilePath = path.join(pendingFilesDirFilePath, pendingFileName)
  const completedFilePath = path.join(completedFilesDirFilePath, completedFileName)

  await fs.copyFile(pendingFilePath, completedFilePath)
  console.log(`copied file from ${pendingFilePath} to ${completedFilePath}`)
}