Blosc compression detection

Skip to first unread message

Miha Vitorovič

May 26, 2020, 7:51:11 AM5/26/20
to blosc
Hi all,

I'm looking at using Blosc (decompression) in an environment where multiple codecs can be used. The decompression should happen transparently (no user intervention), so I'm wondering if there is some way of detecting whether the data received was compressed by Blosc?

Looking at the "bolsc.h" the 'blosc_cbuffer_complib" function like a possible candidate, however the description says it always succeeds - which makes it appear that the input buffer is assumed to contain Blosc compressed data.

Thank you for your answer and best regards, Miha

Francesc Alted

May 26, 2020, 8:52:03 AM5/26/20
to Blosc
Hi Miha,

Yes, `blosc_cbuffer_complib()` is assuming that the buffer is a Blosc one.  C-Blosc2 format adds a new frame format where you can do more strict checks on whether the chunk to decompress is an actual Blosc2 frame (see or not.  However, be aware that C-Blosc2 is not ready for production yet.

For your use case you may want to look into the Blosc1 header ( and try to apply some heuristics from there on your received data.

Hope this helps 

You received this message because you are subscribed to the Google Groups "blosc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Francesc Alted
Reply all
Reply to author
0 new messages