JavaScript solution for encoding and decoding the Bencoding format