[go: up one dir, main page]

brotli 3.1.3

A brotli compressor and decompressor that with an interface avoiding the rust stdlib. This makes it suitable for embedded devices and kernels. It is designed with a pluggable allocator so that the standard lib's allocator may be employed. The default build also includes a stdlib allocator and stream interface. Disable this with --features=no-stdlib. All included code is safe.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys

result = []
cur_count = 0
cur_val = 0
for byte in sys.stdin.read():
    if byte == '1':
        cur_val |= (1<<cur_count)
    elif byte != '0':
        break
    cur_count += 1
    if cur_count == 8:
        result.append(chr(cur_val))
        cur_val = 0
        cur_count = 0
if cur_count != 0:
    result.append(chr(cur_val))
sys.stdout.write(''.join(result))