webtorrent/parse-torrent

Possible to parse a torrent file, change the name, then recreate torrent file?

guanzo opened this issue · 1 comments

Hi. All I want to do is change the name of a torrent file, without having to feed create-torrent the entire file again. Can I simply parse a torrent file, change the name key, then call parseTorrent.toTorrentFile?

It looks like the encodeTorrentFile function doesn't check the name of the parsed argument, so i'm not sure how to proceed. It does check parsed.info, but that seems to be different than the top level keys found in the create-torrent options, which is where the name option is set.

parse-torrent/index.js

Lines 195 to 198 in 6286abb

function encodeTorrentFile (parsed) {
const torrent = {
info: parsed.info
}

Try changing info.name instead