Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Brotli compression #50

Open
Faisal-Manzer opened this issue Jan 12, 2020 · 1 comment
Open

Add support for Brotli compression #50

Faisal-Manzer opened this issue Jan 12, 2020 · 1 comment

Comments

@Faisal-Manzer
Copy link

Brotli is now a widely supported compression type. We should include that too.

@fili
Copy link

fili commented Mar 26, 2020

It would be nice to have this also in this library, however it looks like brotli for now has no fixed file signature, although this has been proposed.

In the meantime you can check if something is brotli compressed by try to decompressing it using brotlipy.

For example:

import brotli

a = brotli.compress(b'test')  # brotli compressed 
b = b'test'  # normal 

def x(y):
    try:
        return bool(brotli.decompress(y))
    except brotli.brotli.Error:
        return False

>>> x(a)
True
>>> x(b)
False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants