webtorrent/parse-torrent

Invalid torrent identifier bug

gyzerok opened this issue · 3 comments

I'm always getting this exception while trying to parse torrent file using:

parseTorrent(fs.readFileSync(path))

It seems to me files are ok since BitTorrent handles them correctly.
Dunno if its ok to give you link here.

The problem here is that Buffer.isBuffer returns false on result of fs.readFileSync. Solution:

parseTorrent(new Buffer(fs.readFileSync(path, { encoding: 'utf8' })))

But after this I'm getting exception Invalid data: Missing delimiter ":" [0x3a] from parse-torrent-file module.
Any ideas?

I think there's some other major issue with your code. Buffer.isBuffer(fs.readFileSync(pathToFile)) always returns true, unless there's some edge case I'm not aware of.

If you can't figure it out, email me the file you think isn't working (email is on my profile).

Had the same problem, @feross is right - the problem is in the command - you have to leave out utf8 cause .torrent file is not a entirely text. That fixed it for me.