Page 1 of 1

load spiffs from http

Posted: Sun Jan 05, 2025 1:31 pm
by Angorka
Good afternoon, colleagues! Please tell me where to find an example of writing a spiffs file *.bin from http.
Thanks!

Re: load spiffs from http

Posted: Mon Jan 06, 2025 7:11 am
by ESP_rrtandler
Hello Angorka,

If you are using ESP IDF, there is no combined example matching exactly what you need. But the basic building code blocks for your needs can be used.
As a starting point, you can look into ESP IDF examples folder. Pick and combine examples for filesystem and communication protocol. Example projects for spiffs are in (examples/storage/spiffs) and for HTTP communication protocol, for example esp_http_client, are in (examples/protocols).

Re: load spiffs from http

Posted: Mon Jan 06, 2025 2:27 pm
by Angorka
Thank you very much!
Yes, I'm trying to figure out esp_http_client right now.
Using esp_http_client_perform(), it seems to be possible to read the file, but I don't understand where it is being written? Next, I want to use esp_partition_write() to write it to spiffs.

static void http()
{
esp_http_client_config_t config = {
.url = "http://192.168.100.10:8070/spiffs1.bin",
.skip_cert_common_name_check = true;
};
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) {
ESP_LOGI(TAG, "Status = %d, content_length = %d",
esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client));
}
esp_http_client_cleanup(client);
}

Re: load spiffs from http

Posted: Wed Jan 08, 2025 1:07 pm
by av_jui
hey

have you seen this post. maybe this will help.

rene

Re: load spiffs from http

Posted: Sat Jan 11, 2025 7:01 am
by Angorka
Thanks, I'll take a look!