|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
import { expect } from 'chai' |
|
|
|
|
import { readFile } from 'fs/promises' |
|
|
|
|
import parseTorrent from 'parse-torrent' |
|
|
|
|
import { basename, join } from 'path' |
|
|
|
|
import type { Instance, Torrent } from 'webtorrent' |
|
|
|
|
import { VideoFile } from '@peertube/peertube-models' |
|
|
|
@ -26,7 +25,9 @@ export async function parseTorrentVideo (server: PeerTubeServer, file: VideoFile
|
|
|
|
|
|
|
|
|
|
const data = await readFile(torrentPath) |
|
|
|
|
|
|
|
|
|
return parseTorrent(data) |
|
|
|
|
// FIXME: use classic import, on node 18.18 we have an error
|
|
|
|
|
// "[ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in .../node_modules/parse-torrent/package.json"
|
|
|
|
|
return require('parse-torrent')(data) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|