let buffer = require('buffer') var client = new WebTorrent() client.on('error', function (err) { console.error('ERROR: ' + err.message) }) // You can pass in a DOM node or a selector string! DragDrop('.drop-div', function (files, pos, fileList, directories) { console.log('Here are the dropped files', files) console.log('Dropped at coordinates', pos.x, pos.y) console.log('Here is the raw FileList object if you need it:', fileList) console.log('Here is the list of directories:', directories) client.seed(files, function (torrent) { console.log(torrent); console.log('Client is seeding ' + torrent.magnetURI) let t = ``; t += `Client is seeding ${torrent.magnetURI}`; t += `
Name: ${torrent.name}
`; t += `Name: ${torrent.path}
`; var hexdata = torrent.torrentFile.toString('hex'); t += `Torrent: ${hexdata}
`; t += ``; t += `${hash}
`; } t += `Peer: ${peer}
`; } t += `${tracker}
`; } $("#seed-result").html(t); }) })