]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/webtorrent.ts
Add CLI plugins tests
[github/Chocobozzz/PeerTube.git] / server / helpers / webtorrent.ts
index 3c9a0b96ae87b21d942da729634c1e4250b4766a..d2a22e8f0e9b79ffbc75d3ae2ff3f27a6618a547 100644 (file)
@@ -2,8 +2,10 @@ import { logger } from './logger'
 import { generateVideoImportTmpPath } from './utils'
 import * as WebTorrent from 'webtorrent'
 import { createWriteStream, ensureDir, remove } from 'fs-extra'
-import { CONFIG } from '../initializers'
+import { CONFIG } from '../initializers/config'
 import { dirname, join } from 'path'
+import * as createTorrent from 'create-torrent'
+import { promisify2 } from './core-utils'
 
 async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) {
   const id = target.magnetUri || target.torrentName
@@ -57,9 +59,12 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName
   })
 }
 
+const createTorrentPromise = promisify2<string, any, any>(createTorrent)
+
 // ---------------------------------------------------------------------------
 
 export {
+  createTorrentPromise,
   downloadWebTorrentVideo
 }