Skip to content
Advertisement

send gzip data without unzipping

I am currently working on a script for RaspberryPi using a SIM module to send data to an FTP server. Problem is, some data are quite large and I formatted them into csv files but still, are a bit large to send through GPRS. By compressing them in gz files it reduces the size by 5 which is great, but in order to send data, the only way is to send data line by line. I was wondering if there was a way to send the information of a gzip file without sending the uncompressed data. Here is my code so far:

JavaScript

Here the length returned is the length of the uncompressed data, but i want to be able to retrieve the uncompressed value of the gzip file? Is it doable?

Thanks for your help.

Advertisement

Answer

JavaScript

specifically requests unzipping. If you just want to read the bare raw binary gzip data, use a regular open:

JavaScript

You don’t need to read the file into memory to fetch its size, though. The os.stat function lets you get information about a file’s metadata without opening it.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement