X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fwebtorrent.ts;h=1c0cc7058a4389ed31c3749f24310b5a422f963a;hb=a651038487faa838bda3ce04695b08bc65baff70;hp=6f2adb3cb447d9eb74bfbffbc2821b493eccc84f;hpb=541006e355c927a866d58cced016f48e139670d5;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 6f2adb3cb..1c0cc7058 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts @@ -1,10 +1,9 @@ import { logger } from './logger' import { generateVideoTmpPath } from './utils' import * as WebTorrent from 'webtorrent' -import { createWriteStream } from 'fs' +import { createWriteStream, remove } from 'fs-extra' import { CONFIG } from '../initializers' import { join } from 'path' -import { unlinkPromise } from './core-utils' function downloadWebTorrentVideo (target: { magnetUri: string, torrentName: string }) { const id = target.magnetUri || target.torrentName @@ -29,11 +28,11 @@ function downloadWebTorrentVideo (target: { magnetUri: string, torrentName: stri if (err) return rej(err) if (target.torrentName) { - unlinkPromise(torrentId) + remove(torrentId) .catch(err => logger.error('Cannot remove torrent %s in webtorrent download.', torrentId, { err })) } - unlinkPromise(join(CONFIG.STORAGE.VIDEOS_DIR, file.name)) + remove(join(CONFIG.STORAGE.VIDEOS_DIR, file.name)) .catch(err => logger.error('Cannot remove torrent file %s in webtorrent download.', file.name, { err })) res(path)