-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encode object didn't support binary(buffer) as obj key #88
Comments
Yeah we kind of where working on that in ~2014 but never really made any good progress that does not break the interface or destroy performance for all other cases. That beeing said, if I'm wrong about the spec, or if we find a way to support this without reducing useability for other users I'll be happy to help getting this implemented. |
With bittorrent v2 format going popular, I'm starting to see byte strings being used as obj keys. For example, the key of https://www.bittorrent.org/beps/bep_0052.html You can find example torrents in v2 format in this blog post: https://blog.libtorrent.org/2020/09/bittorrent-v2/ |
in my case import fs from 'fs'
import bencode from 'bencode'
var buffer = fs.readFileSync("input-v2-only.torrent")
var object = bencode.decode(buffer)
var objectUtf8 = bencode.decode(buffer, 'utf8')
var objectAscii = bencode.decode(buffer, 'ascii')
console.log(Object.keys(object['piece layers'])[0])
console.log(Object.keys(objectUtf8['piece layers'])[0])
console.log(Object.keys(objectAscii['piece layers'])[0]) gives
which looks like a bug with encoding utf8 and ascii |
bittorrent scrape need to use infohash as key, it is a binary.
The text was updated successfully, but these errors were encountered: