aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/files-cache/abstract-video-static-file-cache.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-24 09:28:06 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:26:21 +0200
commitdc8527376482293c87fc6f30027d626f58a1197b (patch)
tree688625c5ab1619c3235f808a22bed0501c670a62 /server/lib/files-cache/abstract-video-static-file-cache.ts
parent3acc50844047a37698f0618fa235c138e386a053 (diff)
downloadPeerTube-dc8527376482293c87fc6f30027d626f58a1197b.tar.gz
PeerTube-dc8527376482293c87fc6f30027d626f58a1197b.tar.zst
PeerTube-dc8527376482293c87fc6f30027d626f58a1197b.zip
Refactor video caption/preview caches
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}