diff options
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.ts | 16 |
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 @@ | |||
1 | import { createWriteStream, remove } from 'fs-extra' | 1 | import { remove } from 'fs-extra' |
2 | import { logger } from '../../helpers/logger' | 2 | import { logger } from '../../helpers/logger' |
3 | import { VideoModel } from '../../models/video/video' | ||
4 | import { fetchRemoteVideoStaticFile } from '../activitypub' | ||
5 | import * as memoizee from 'memoizee' | 3 | import * as memoizee from 'memoizee' |
6 | 4 | ||
7 | type GetFilePathResult = { isOwned: boolean, path: string } | undefined | 5 | type 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 | } |