aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/files-cache/abstract-video-static-file-cache.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/files-cache/abstract-video-static-file-cache.ts')
-rw-r--r--server/lib/files-cache/abstract-video-static-file-cache.ts16
1 files changed, 1 insertions, 15 deletions
diff --git a/server/lib/files-cache/abstract-video-static-file-cache.ts b/server/lib/files-cache/abstract-video-static-file-cache.ts
index 84ed74c98..1908cfb06 100644
--- a/server/lib/files-cache/abstract-video-static-file-cache.ts
+++ b/server/lib/files-cache/abstract-video-static-file-cache.ts
@@ -1,7 +1,5 @@
1import { createWriteStream, remove } from 'fs-extra' 1import { remove } from 'fs-extra'
2import { logger } from '../../helpers/logger' 2import { logger } from '../../helpers/logger'
3import { VideoModel } from '../../models/video/video'
4import { fetchRemoteVideoStaticFile } from '../activitypub'
5import * as memoizee from 'memoizee' 3import * as memoizee from 'memoizee'
6 4
7type GetFilePathResult = { isOwned: boolean, path: string } | undefined 5type GetFilePathResult = { isOwned: boolean, path: string } | undefined
@@ -29,16 +27,4 @@ export abstract class AbstractVideoStaticFileCache <T> {
29 } 27 }
30 }) 28 })
31 } 29 }
32
33 protected saveRemoteVideoFileAndReturnPath (video: VideoModel, remoteStaticPath: string, destPath: string) {
34 return new Promise<string>((res, rej) => {
35 const req = fetchRemoteVideoStaticFile(video, remoteStaticPath, rej)
36
37 const stream = createWriteStream(destPath)
38
39 req.pipe(stream)
40 .on('error', (err) => rej(err))
41 .on('finish', () => res(destPath))
42 })
43 }
44} 30}