// Decode String
await bencode.decode("d3:fooli123ed3:bar3:bazeee") // => {foo: [123, {bar: "baz"}]}
// Decode with Stream
const src = await Deno.open("./test_input.txt");
const stream = src.readable.pipeThrough(new bencode.Uint8ArrayToBencodeStream())
for await (const v of stream) {
console.log(v);
}
// Encode String
bencode.encode({foo: [123, {bar: "baz"}]}) // => "d3:fooli123ed3:bar3:bazeee"
Copyright (c) 2021-2024 Masashi Iizuka
Distributed under the MIT License.