large binary file OTA updates

I'm developing a functionality to enable OTA updates to a ESP32 microcontroller from my web server. The ESP32 connects to the server and downloads the file correctly (I've checked by downloading a .ino and printing the file when downloaded).
Now I was trying to download a binary file from the web server, but the httpclient.getString() function doesn't work anymore, because the file is to big (890,768 bytes). On a side note, how can the binary be larger than SRAM (520KiB) anyway?? (the binary is from a sketch I was already using on the esp)

I'm trying to do it so that the dowloaded files goes directly into a SPIFFS file in flash memory, which is 4MB in the ESP32 vs 520KiB of SRAM, but I can't get it to work. This is what I get on the serial monitor:

11:17:28.498 -> [D][HTTPClient.cpp:1025] connect():  connected to 192.168.1.40:443
11:17:28.531 -> [D][HTTPClient.cpp:1158] handleHeaderResponse(): code: 200
11:17:28.531 -> [D][HTTPClient.cpp:1161] handleHeaderResponse(): size: 890768
11:17:28.531 -> [W][SPIFFS.cpp:54] begin(): SPIFFS Already Mounted!
11:17:28.531 -> [D][HTTPClient.cpp:850] getString(): not enough memory to reserve a string! need: 890769
11:17:28.531 -> Starting update..
11:17:28.531 -> Cannot do the update

And this is the code:

if (httpCode > 0) { //Check for the returning code

        if(!SPIFFS.begin(true)){
          Serial.println("An Error has occurred while mounting SPIFFS");
          return;
        }
        
        File file = SPIFFS.open("/firmware", "w");

        
        //String payload = http.getString();
        file.print(http.getString());

        file.close();

        file = SPIFFS.open("/firmware");
  
        if(!file){
          Serial.println("Failed to open file for reading");
          return;
        }
       
        Serial.println("Starting update..");
        
 
        size_t fileSize = file.size();
 
        if(!Update.begin(fileSize)){
       
          Serial.println("Cannot do the update");
          return;
        };
 
        Update.writeStream(file);
 
        if(Update.end()){
       
          Serial.println("Successful update");  
        }else {
       
          Serial.println("Error Occurred: " + String(Update.getError()));
          return;
        }
     
        file.close();

delay(2000);
 
        ESP.restart();

Is there a way of making it work differently or am I missing something?