Skip to main content

Multicodec implementation in Python

Project description

py-multicodec

https://img.shields.io/pypi/v/py-multicodec.svg https://img.shields.io/travis/multiformats/py-multicodec.svg https://codecov.io/gh/multiformats/py-multicodec/branch/master/graph/badge.svg Documentation Status Updates

Multicodec implementation in Python

multicodec is a self-describing multiformat, it wraps other formats with a tiny bit of self-description.

A multicodec identifier is both a varint and the code identifying the following data, this means that the most significant bit of every multicodec code is reserved to signal the continuation.

You can check the table here for the list of supported codecs by py-multicodec.

Installation

$ pip install py-multicodec

Sample Usage

>>> from multicodec import add_prefix, remove_prefix, get_codec
>>> # adding a prefix to existing data
>>> add_prefix('sha2-256', 'EiC5TSe5k00')
b'\x12EiC5TSe5k00'
>>> # removing prefix from prefixed data
>>> remove_prefix(b'\x12EiC5TSe5k00')
EiC5TSe5k00
>>> # get codec used to prefix the prefixed data
>>> get_codec(b'\x12EiC5TSe5k00')
'sha2-256'

History

0.1.0 (2017-09-03)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-multicodec, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size py_multicodec-0.1.2-py2.py3-none-any.whl (6.5 kB) File type Wheel Python version 3.5 Upload date Hashes View hashes
Filename, size py-multicodec-0.1.2.tar.gz (19.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page