Torrent to Magnet: By parsing the torrent file, obtaining the file's metadata, extracting the info field from the parsed metadata, and calculating its SHA-1 hash value, which becomes the infoHash, to achieve the conversion process from torrent to magnet link.