-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP client file download. #2861
Comments
:-) |
@fredericplante there is an httpClient class implementation. But this is not the right place to ask for usage help. |
I got it working like this :) you put file url and program saves the file to SPIFFS.
|
http - what is it? what type? Where did you copy this pice of code? |
If you want to download A file(any type I assume) and save it to SPIFFS you can use the code above. This code should be copied to your ESP8266 program. |
To make this code work you'll nead:
This code work only to http://... url. If I want to download file from https://... url - it not work. For https url I write next method (I actually get it from example and make some adaptation for my own newads) It work fine for small files (2..3 Kbytes). But when file is larger (30Kbytes) - the download stops before I reach Content-lenth
Code:
|
Hello, Since it is possible to download, Would it be possible to measure the internet speed (up to the bandwidth that the ESP8266 supports)? Would it be possible to download the data without saving to be able to download a larger file, maybe a 5MB or 10MB to perform an average speed? Any suggestion? |
If you commentout f variable - then you can read data without saving. |
@rtek1000 Well actually HTTPClient::writeToStream function(the one I used in example code above) returns bytes written (negative values are error codes ). As for not saving the file, it's been quite some time since I last programmed esp32 (I don't have one to test anymore) but you should also check in HttpClient class, there is a function getSize, maybe you can get it working:
|
It is nice to see that this turn out to be usefull after all. Thank you all for the suggestion, I see it could also be easily modified to save to a SDcard, that is nice. :) |
Is there an example that use the HTTP client to connect to a HTTP server, request a file, download it and then save it to SPIFFS?
You know, what a HTTP client should be doing. :D
The text was updated successfully, but these errors were encountered: