How to use the blosc.blosc_extension.compress function in blosc

To help you get started, we’ve selected a few blosc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Blosc / python-blosc / blosc / toplevel.py View on Github external
>>> import array
    >>> a = array.array('i', range(1000*1000))
    >>> a_bytesobj = a.tostring()
    >>> c_bytesobj = blosc.compress(a_bytesobj, typesize=4)
    >>> len(c_bytesobj) < len(a_bytesobj)
    True

    """

    _check_input_length('bytesobj', len(bytesobj))
    _check_typesize(typesize)
    _check_shuffle(shuffle)
    _check_clevel(clevel)
    _check_cname(cname)

    return _ext.compress(bytesobj, typesize, clevel, shuffle, cname)
github Blosc / c-blosc2 / python / blosc / toplevel.py View on Github external
True

    """

    if type(string) is not bytes:
        raise ValueError(
            "only string (2.x) or bytes (3.x) objects supported as input")

    if len(string) > _ext.BLOSC_MAX_BUFFERSIZE:
        raise ValueError("string length cannot be larger than %d bytes" % \
                         _ext.BLOSC_MAX_BUFFERSIZE)

    if clevel < 0 or clevel > 9:
        raise ValueError("clevel can only be in the 0-9 range.")

    return _ext.compress(string, typesize, clevel, shuffle)