1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Add comments federation tests

This commit is contained in:
Chocobozzz 2017-12-27 20:03:37 +01:00
parent ae45f988bb
commit d50acfab69
No known key found for this signature in database
GPG key ID: 583A612D890159BE
10 changed files with 136 additions and 57 deletions

View file

@ -52,21 +52,19 @@ class VideosPreviewCache {
if (video.isOwned()) throw new Error('Cannot load preview of owned video.')
const res = await this.saveRemotePreviewAndReturnPath(video)
return res
return this.saveRemotePreviewAndReturnPath(video)
}
private saveRemotePreviewAndReturnPath (video: VideoModel) {
const req = fetchRemoteVideoPreview(video)
return new Promise<string>((res, rej) => {
const req = fetchRemoteVideoPreview(video, rej)
const path = join(CACHE.DIRECTORIES.PREVIEWS, video.getPreviewName())
const stream = createWriteStream(path)
req.pipe(stream)
.on('finish', () => res(path))
.on('error', (err) => rej(err))
.on('error', (err) => rej(err))
.on('finish', () => res(path))
})
}
}