jbilcke-hf HF staff commited on
Commit
cab8fdd
1 Parent(s): 4f2c4e2

trying another approach because of EXDEV: cross-device link not permitted

Browse files
src/enhanceVideo.mts CHANGED
@@ -23,7 +23,12 @@ export const enhanceVideo = async (fileName: string): Promise<string> => {
23
  .videoFilters('noise=c0s=10:c0f=t+u')
24
  .save(tmpFilePath)
25
  .on('end', async () => {
26
- await fs.promises.rename(tmpFilePath, filePath)
 
 
 
 
 
27
 
28
  resolve(fileName)
29
  })
 
23
  .videoFilters('noise=c0s=10:c0f=t+u')
24
  .save(tmpFilePath)
25
  .on('end', async () => {
26
+ await fs.promises.copyFile(tmpFilePath, filePath)
27
+ try {
28
+ await fs.promises.unlink(tmpFilePath)
29
+ } catch (err) {
30
+ console.log('failed to cleanup (no big deal..)')
31
+ }
32
 
33
  resolve(fileName)
34
  })
src/keepVideo.mts CHANGED
@@ -7,7 +7,12 @@ export const keepVideo = async (fileName: string): Promise<string> => {
7
  const sourceFilePath = path.join(tmpDir, fileName)
8
  const targetFilePath = path.join(process.env.WEBTV_VIDEO_STORAGE_PATH_NEXT, fileName)
9
 
10
- await fs.promises.rename(sourceFilePath, targetFilePath)
 
 
 
 
 
11
 
12
  return targetFilePath
13
  }
 
7
  const sourceFilePath = path.join(tmpDir, fileName)
8
  const targetFilePath = path.join(process.env.WEBTV_VIDEO_STORAGE_PATH_NEXT, fileName)
9
 
10
+ await fs.promises.copyFile(sourceFilePath, targetFilePath)
11
+ try {
12
+ await fs.promises.unlink(sourceFilePath)
13
+ } catch (err) {
14
+ console.log('failed to cleanup (no big deal..)')
15
+ }
16
 
17
  return targetFilePath
18
  }
src/upscaleVideo.mts CHANGED
@@ -64,7 +64,12 @@ export async function upscaleVideo(fileName: string, prompt: string) {
64
  const tmpFilePath = path.join(tmpDir, tmpFileName)
65
  const filePath = path.join(tmpDir, fileName)
66
 
67
- await fs.promises.rename(tmpFilePath, filePath)
 
 
 
 
 
68
 
69
  return fileName
70
  }
 
64
  const tmpFilePath = path.join(tmpDir, tmpFileName)
65
  const filePath = path.join(tmpDir, fileName)
66
 
67
+ await fs.promises.copyFile(tmpFilePath, filePath)
68
+ try {
69
+ await fs.promises.unlink(tmpFilePath)
70
+ } catch (err) {
71
+ console.log('failed to cleanup (no big deal..)')
72
+ }
73
 
74
  return fileName
75
  }