@@ -871,13 +871,12 @@ function saveTorrentFileAs (torrentSummary) {
|
|||||||
filters: [{ name: 'Torrents', extensions: ['torrent'] }]
|
filters: [{ name: 'Torrents', extensions: ['torrent'] }]
|
||||||
}
|
}
|
||||||
dialog.showSaveDialog(remote.getCurrentWindow(), opts, (savePath) => {
|
dialog.showSaveDialog(remote.getCurrentWindow(), opts, (savePath) => {
|
||||||
var torrentFile = fs.createReadStream(torrentSummary.torrentPath)
|
fs.readFile(torrentSummary.torrentPath, function (err, torrentFile) {
|
||||||
var savedTorrentFile = fs.createWriteStream(savePath)
|
if (err) return onError(err)
|
||||||
torrentFile.on('error', (err) => console.error('Error reading torrent file', err))
|
fs.writeFile(savePath, torrentFile, function (err) {
|
||||||
savedTorrentFile.on('error', (err) => console.error('Error saving torrent file', err))
|
if (err) return onError(err)
|
||||||
savedTorrentFile.on('close', () => console.log('Torrent saved', savePath))
|
})
|
||||||
|
})
|
||||||
torrentFile.pipe(savedTorrentFile)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user