Title: | Tools for handing Bencoding |
---|---|
Description: | This package provides tools for handling Bencoding. |
Authors: | Simon Urbanek <[email protected]> |
Maintainer: | Simon Urbanek <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 0.1-1 |
Built: | 2024-12-16 03:58:06 UTC |
Source: | https://github.com/s-u/bencoding |
readBenc
reads content in Bencoding into R objects.
readBenc(what)
readBenc(what)
what |
character string of file name(s), binary connection or a raw vector |
Bencoding defines integers, strings, lists and dictionaries which are stored as integer (or real) scalars, string scalars, pairlists and named parilists respectively.
Decoded content. If what
is a character vector of more than one
element then the result is a list equivalent to
lapply(what, readBenc)
.
In principle Bencoding supports integers of arbitary precision, but R only supports signed integers up to 32-bit. All values outsisde that range will be stored as (double-precision) reals. This means that only signed integers up to 53-bit precision will be represented without loss of precision.
R does not allow strings with embedded NULs, so any string with a value less than TAB is returned as a raw vector.
Simon Urbanek
ex <- charToRaw("d1:ai100e1:bl3:fooi123456789012345e3:baree") readBenc(ex)
ex <- charToRaw("d1:ai100e1:bl3:fooi123456789012345e3:baree") readBenc(ex)