Closed jhermsmeier closed 1 year ago
I think this needs a new merge from master (with conflict solving in encode.js) and we need to remove the float test since this breaks with bigint.
superseeded by https://github.com/webtorrent/node-bencode/pull/150
So, this is a fun one I noticed yesterday: Number.toString() can not be relied upon to give you all digits of an integer:
While this is reasonably unlikely to happen in real-world usage as Number.toString() starts returning exponential notation at 270, it still could occur, and considering this might be run on other engines than V8 which might have different limits, this could potentially occur sooner.
Unfortunately the only fix I found for this is going through
BigInt()
– I guess we could hand-roll something, butBigInt()
seems to be the reliable thing to go for here – what do you think?