Skip to content

holepunchto/compact-encoding-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

compact-encoding-python

Pure-Python port of compact-encoding, wire-compatible with the JavaScript implementation. All multi-byte values are little-endian.

Usage

import compact_encoding as cenc

data = cenc.encode(cenc.uint, 42)     # -> bytes
n = cenc.decode(cenc.uint, data)      # -> 42

Codecs

uint, uint32, int, utf8 (alias string), bool, buffer.

Three-phase API

import compact_encoding as cenc

state = cenc.State()
cenc.uint.preencode(state, 42)
cenc.utf8.preencode(state, "hi")
state.allocate()
cenc.uint.encode(state, 42)
cenc.utf8.encode(state, "hi")

About

Compact encoding schemes for Python with the same ABI as https://github.com/holepunchto/compact-encoding

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages