Open sbousamra opened 5 years ago
Hi, This sounds like a nice feature to consider adding. I will pass this internally for consideration.
Hi,
Even though an explicit way to request for a .zip
file is still valid, we have some interesting findings to share.
After some testing it seems that both current browsers and node will auto-gzip all traffic when the server supports it (balenaCloud does) and auto-expand while saving to disk.
As a result even if you end up with a 900MB .img
file in your filesystem, the amount of data that goes over-the-wire is actually quite smaller, to a degree that's comparable with the sizes of the respective .zip
files.
You can also give this a try by timing how much time your browser needs to download a full vs a zipped image: https://api.balena-cloud.com/download?deviceType=raspberrypi4-64&version=2.75.0%2Brev1.prod https://api.balena-cloud.com/download?deviceType=raspberrypi4-64&version=2.75.0%2Brev1.prod&fileType=.zip
and then in order to compare those with the sdk method as well, you can time the balena-cli's download command in your terminal with something like:
time balena os download raspberrypi4-64 --version 2.75.0+rev1.prod -o ./tmp.img
In my tests all those took about 33 seconds and for each of them my system's data meter couldn't track more than 200MB of overall data traffic during that time window.
For internal future reference: See: https://www.flowdock.com/app/rulemotion/r-beginners/threads/nFpqGUwLNhVUJnPlSTfNU-ixwkN
Expected Behavior
The file streamed from balena().models.os.download to be a compressed version of the OS image.
Actual Behavior
balena().models.os.download(deviceType, version) is giving me an uncompressed version of the OS image (e.g. intel-nuc latest version is ~1.5gb, when compressed it is ~200mb), is there a reason this is uncompressed or is it possible for there to be an option to request it in a compressed format to reduce the download size?
Steps to Reproduce the Problem
Specifications
References
Uncompressed
Compressed