I have implemented the following code:
I can send info from the server indicating how big the zip file is and how big the unpacked directory is. However, how can I detect if there is enough space on the device to download and unzip the file? I assume once I figure this out I can just do a check like this:
if (free_space_on_device > zip_size + unpacked_size){
proceed with steps 1 through 3 (listed above)
}
I did not realize that RNFS had a function called getFSInfo. With that knowledge, I can just issue the following command:
RNFS.getFSInfo()
.then ((info) => {
console.log("Free Space is" + info.freeSpace + "Bytes")
console.log("Free Space is" + info.freeSpace / 1024 + "KB")
})