I have created a new libray which uses Heatshrink compression to compress files on an SD card.
I use this library on the electron to compress files before sending them to an FTP server. This saves about 50% of data.
@rickkas7 Wanted to ping you just so you know this is available. Sounds perfect for your FTP upload library, especially if your uploading image files from a camera.
Just curious if there is software available to decompress the files. The info on GitHub is a bit lacking, and Googling it doesn’t seem to bring any useful results.
I have an electron project that could really use the compression this seems to accomplish, but I’m at a loss as to how to decompress the data once it is uploaded to the cloud.
@MichaelTriad, the data is shrunk using the heatshrink library. A binary version that can be run on a linux computer can be found in the bin directory. I see now that I did not include a description on how the run the heatshrink program.
Copy heatshrink to /usr/local/bin on a linux pc. Now you can call
Hmm, after some trial and error it appears that the Raspbian version of Linux can’t run that. Going to try with a virtual machine now that I have a little better idea of where to put what and all.
Ah right, that is the case yes. You need a x86 processor to run the binary. The other solution is to download the source from github and compile the source yourself using make.
Run:
git clone https://github.com/atomicobject/heatshrink.git
cd heatshrink
make
and if make and the right compiler is installed, you will get a heatshrink binary compatible with your platform.
There a quite a few tutorials on internet for compiling from source on Raspbian, so I suggest you read one of those if this explanation is too short.
I will update the readme so the next person has an answer to those questions.
It took a bit, having to deal with some idiosyncrasies of a virtual machine and permissions to access things, but I got it to work. A file compressed with the library on an Electron was successfully decompressed and perfectly matched the original.
I usually like using LInux, but there are times it tries my patience!
Thanks for your input and for creating the library!
I have a new question regarding the compression library: could it be used on a directory to not only compress the data, but combine the files in the directory? (Someone on the project wants a bunch of individual log files instead of one long one.)
I don’t know if this is possible. I believe my code is not build to do this. We do several log files as well, but just compress them one by one and then send them over FTP.