Compressed data from miniz gets corrupted when saving to storage

jithin1991
Posts: 4
Joined: Mon Feb 19, 2024 12:21 am

Compressed data from miniz gets corrupted when saving to storage

Postby jithin1991 » Tue Feb 20, 2024 11:28 pm

Hi,

I am using miniz to compress a string and I want to store the data in to storage and read back back to decompress it.

Currently I'm using set_string and get_string to write and read the data to storage. But my compressed data gets corrupted when saving to the storage, means the data that I'm storing is not what I'm getting. Usually its couple of bytes missing or added to compressed data when I'm saving.

I tried using save_to_blob which also has the same issue.

I'm using an esp32S3 wroom.

Any help would be much appreciated

jithin1991
Posts: 4
Joined: Mon Feb 19, 2024 12:21 am

Re: Compressed data from miniz gets corrupted when saving to storage

Postby jithin1991 » Fri Feb 23, 2024 4:24 am

Fixed it. Compressed data has got null terminators in between. when we save the compressed data as string, it saves the data as string until it sees the first null terminator.

I used set blob to save the data (I was not using it correctly before) and it fixed the issue

Who is online

Users browsing this forum: MicroController and 67 guests