VideoChain-API / src /utils /copyVideoFromPendingToCompleted.mts
jbilcke-hf's picture
jbilcke-hf HF staff
ready for release (sort of)
9571f2e
raw
history blame
636 Bytes
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}`)
}