2022-01-10 20:25:36 +03:00
|
|
|
def _bencode_torepr:
|
2022-03-08 19:09:48 +03:00
|
|
|
if .type == "string" then .value | tovalue
|
|
|
|
elif .type == "integer" then .value | tovalue
|
|
|
|
elif .type == "list" then .values | map(_bencode_torepr)
|
|
|
|
elif .type == "dictionary" then
|
|
|
|
( .pairs
|
|
|
|
| map({key: (.key | _bencode_torepr), value: (.value | _bencode_torepr)})
|
|
|
|
| from_entries
|
|
|
|
)
|
|
|
|
else error("unknown type \(.type)")
|
|
|
|
end;
|
2021-12-09 19:15:21 +03:00
|
|
|
|
|
|
|
def _bencode__help:
|
2022-05-05 20:38:31 +03:00
|
|
|
{ links: [
|
2022-06-13 19:49:30 +03:00
|
|
|
{url: "https://wiki.theory.org/BitTorrentSpecification#Bencoding"}
|
2021-12-09 19:15:21 +03:00
|
|
|
]
|
|
|
|
};
|