Package 'bencoding'

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

Help Index


Read content encoded in Bencoding

Description

readBenc reads content in Bencoding into R objects.

Usage

readBenc(what)

Arguments

what

character string of file name(s), binary connection or a raw vector

Details

Bencoding defines integers, strings, lists and dictionaries which are stored as integer (or real) scalars, string scalars, pairlists and named parilists respectively.

Value

Decoded content. If what is a character vector of more than one element then the result is a list equivalent to lapply(what, readBenc).

Note

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.

Author(s)

Simon Urbanek

Examples

ex <- charToRaw("d1:ai100e1:bl3:fooi123456789012345e3:baree")
  readBenc(ex)