diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-15 09:22:57 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 30ff39e7f07898ebb716c938123825c678b4e5af (patch) | |
tree | 338b55203ee757a0e5e3f2e449536b925c677556 /server/helpers/webtorrent.ts | |
parent | b2195fafc292d6761c25fe51ca4e0328ab403424 (diff) | |
download | PeerTube-30ff39e7f07898ebb716c938123825c678b4e5af.tar.gz PeerTube-30ff39e7f07898ebb716c938123825c678b4e5af.tar.zst PeerTube-30ff39e7f07898ebb716c938123825c678b4e5af.zip |
Move createTorrent in webtorrent utils
Diffstat (limited to 'server/helpers/webtorrent.ts')
-rw-r--r-- | server/helpers/webtorrent.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 14dfe0d28..d2a22e8f0 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts | |||
@@ -4,6 +4,8 @@ import * as WebTorrent from 'webtorrent' | |||
4 | import { createWriteStream, ensureDir, remove } from 'fs-extra' | 4 | import { createWriteStream, ensureDir, remove } from 'fs-extra' |
5 | import { CONFIG } from '../initializers/config' | 5 | import { CONFIG } from '../initializers/config' |
6 | import { dirname, join } from 'path' | 6 | import { dirname, join } from 'path' |
7 | import * as createTorrent from 'create-torrent' | ||
8 | import { promisify2 } from './core-utils' | ||
7 | 9 | ||
8 | async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) { | 10 | async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) { |
9 | const id = target.magnetUri || target.torrentName | 11 | const id = target.magnetUri || target.torrentName |
@@ -57,9 +59,12 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName | |||
57 | }) | 59 | }) |
58 | } | 60 | } |
59 | 61 | ||
62 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) | ||
63 | |||
60 | // --------------------------------------------------------------------------- | 64 | // --------------------------------------------------------------------------- |
61 | 65 | ||
62 | export { | 66 | export { |
67 | createTorrentPromise, | ||
63 | downloadWebTorrentVideo | 68 | downloadWebTorrentVideo |
64 | } | 69 | } |
65 | 70 | ||