synodriver / fast-bencode

fast bencode for python, based on cython

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

✨ fast-bencode ✨

The cython version of bencode

pypi python implementation wheel license action

forked from bencode to support latest version of python

  • extra cython extension to speedup
  • typing with mypy check

Usage

from pprint import pprint
from bencode import bdecode, bencode

with open("test.torrent", "rb") as f:
    data = f.read()

raw = bdecode(data)
pprint(raw)

assert bencode(raw) == data
  • There are alias function loads for bdecode and dumps for bencode

build

git clone https://github.com/synodriver/fast-bencode.git
cd fast-bencode
python setup.py build_ext -i

About

fast bencode for python, based on cython


Languages

Language:C 73.6%Language:Cython 15.0%Language:Python 11.4%