• Thanks very much, a very useful article!

    There looks like some tiny issues with the code however.

    1. Buffer is an internal buffer which may or may not contain the whole set of bytes in the blob.

    byte[] blobData = blob.Buffer;

    i think should be this --

    byte[] blobData = blob.Value;

    Or alternatively you could read chunks from the buffer. loop writing them into the compressor

    2. The decompressedData needs to be flushed before closing.

    decompressedData.Flush()

    Without these changes my blobs had issues where the decompressed data was not identical to the original compressed data:

    CHECKSUM(myBlob)<>CHECKSUM(Decompress(Compress(myBlob))

    and

    myBlob <> Decompress(Compress(myBlob))