load spiffs from http

Angorka
Posts: 6
Joined: Wed Sep 18, 2024 8:02 am

load spiffs from http

Postby Angorka » Sun Jan 05, 2025 1:31 pm

Good afternoon, colleagues! Please tell me where to find an example of writing a spiffs file *.bin from http.
Thanks!

ESP_rrtandler
Posts: 53
Joined: Wed May 31, 2023 6:54 pm

Re: load spiffs from http

Postby ESP_rrtandler » Mon Jan 06, 2025 7:11 am

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).

Angorka
Posts: 6
Joined: Wed Sep 18, 2024 8:02 am

Re: load spiffs from http

Postby Angorka » Mon Jan 06, 2025 2:27 pm

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);
}

av_jui
Posts: 8
Joined: Wed Jan 08, 2025 11:09 am

Re: load spiffs from http

Postby av_jui » Wed Jan 08, 2025 1:07 pm

hey

have you seen this post. maybe this will help.

rene
Visit my github account :arrow: https://github.com/avjui

Angorka
Posts: 6
Joined: Wed Sep 18, 2024 8:02 am

Re: load spiffs from http

Postby Angorka » Sat Jan 11, 2025 7:01 am

Thanks, I'll take a look!

Who is online

Users browsing this forum: Perplexity-User, Qwantbot and 2 guests