aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/webtorrent.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-15 09:22:57 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit30ff39e7f07898ebb716c938123825c678b4e5af (patch)
tree338b55203ee757a0e5e3f2e449536b925c677556 /server/helpers/webtorrent.ts
parentb2195fafc292d6761c25fe51ca4e0328ab403424 (diff)
downloadPeerTube-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.ts5
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'
4import { createWriteStream, ensureDir, remove } from 'fs-extra' 4import { createWriteStream, ensureDir, remove } from 'fs-extra'
5import { CONFIG } from '../initializers/config' 5import { CONFIG } from '../initializers/config'
6import { dirname, join } from 'path' 6import { dirname, join } from 'path'
7import * as createTorrent from 'create-torrent'
8import { promisify2 } from './core-utils'
7 9
8async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) { 10async 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
62const createTorrentPromise = promisify2<string, any, any>(createTorrent)
63
60// --------------------------------------------------------------------------- 64// ---------------------------------------------------------------------------
61 65
62export { 66export {
67 createTorrentPromise,
63 downloadWebTorrentVideo 68 downloadWebTorrentVideo
64} 69}
65 70