diff --git a/core/io/http_client.h b/core/io/http_client.h index 1dc1f3d76ae2..a233d2d038b9 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -182,7 +182,8 @@ private: int response_num = 0; Vector response_headers; - int read_chunk_size = 4096; + // 64 KiB by default (favors fast download speeds at the cost of memory usage). + int read_chunk_size = 65536; Error _get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received); diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index c308caab505f..ec8ca7456a31 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -181,7 +181,7 @@ The connection to use for this client. - + The size of the buffer used and maximum bytes to read per iteration. See [method read_response_body_chunk]. diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 6c3d0102b9be..6eae881ffe52 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -151,9 +151,9 @@ Maximum allowed size for response bodies. If the response body is compressed, this will be used as the maximum allowed size for the decompressed body. - + The size of the buffer used and maximum bytes to read per iteration. See [member HTTPClient.read_chunk_size]. - Set this to a higher value (e.g. 65536 for 64 KiB) when downloading large files to achieve better speeds at the cost of memory. + Set this to a lower value (e.g. 4096 for 4 KiB) when downloading small files to decrease memory usage at the cost of download speeds. The file to download into. Will output any received file into it.