fix torrent file download

This commit is contained in:
TheBeastLT
2021-09-19 19:10:45 +02:00
parent 6f136c2ecf
commit e09f4c6269

View File

@@ -113,12 +113,12 @@ async function filesFromTorrentFile(torrent) {
return Promise.reject(new Error("no torrentLink"));
}
return axios.get(torrent.torrentLink, { timeout: 10000 })
return axios.get(torrent.torrentLink, { timeout: 10000, responseType: 'arraybuffer' })
.then((response) => {
if (!response.data || response.status !== 200) {
throw new Error('torrent not found')
}
return response.body
return response.data
})
.then((body) => parseTorrent(body))
.then((info) => info.files.map((file, fileId) => ({