Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}), function (err, input) {
if (self.destroyed) return
if (err) return torrent._destroy(err)
createTorrent.parseInput(input, opts, function (err, files) {
if (self.destroyed) return
if (err) return torrent._destroy(err)
streams = files.map(function (file) {
return file.getStream
})
createTorrent(input, opts, function (err, torrentBuf) {
if (self.destroyed) return
if (err) return torrent._destroy(err)
var existingTorrent = self.get(torrentBuf)
if (existingTorrent) {
torrent._destroy(new Error('Cannot add duplicate torrent ' + existingTorrent.infoHash))
} else {
torrent._onTorrentId(torrentBuf)
}), (err, input) => {
if (this.destroyed) return
if (err) return torrent._destroy(err)
createTorrent.parseInput(input, opts, (err, files) => {
if (this.destroyed) return
if (err) return torrent._destroy(err)
streams = files.map(file => file.getStream)
createTorrent(input, opts, (err, torrentBuf) => {
if (this.destroyed) return
if (err) return torrent._destroy(err)
const existingTorrent = this.get(torrentBuf)
if (existingTorrent) {
torrent._destroy(new Error(`Cannot add duplicate torrent ${existingTorrent.infoHash}`))
} else {
torrent._onTorrentId(torrentBuf)
}
})