const fs = require('fs') module.exports = magnet = (async path => { const parseTorrent = await import('parse-torrent') const parse = parseTorrent.default const magnetURI = parseTorrent.toMagnetURI let data = await parse(fs.readFileSync(path)) let uri = await magnetURI({ infoHash: data.infoHash }) return uri })