# How to download files from the internet using gdscript?

**URL:** <https://forum.godotengine.org/t/how-to-download-files-from-the-internet-using-gdscript/8163>\
**Category:** Archive\
**Created:** [September 23, 2021, 10:41pm UTC](https://forum.godotengine.org/t/how-to-download-files-from-the-internet-using-gdscript/8163 "2021-09-23T22:41:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forum.godotengine.org/uploads/default/original/2X/4/4b0a7fa8a6334634b94a13d421f0d99e6f04e21f.svg) [@system](https://forum.godotengine.org/u/system)\
**Post date:** [September 23, 2021, 10:41pm UTC](https://forum.godotengine.org/t/how-to-download-files-from-the-internet-using-gdscript/8163/1 "2021-09-23T22:41:35Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Attention** | Topic was automatically imported from the old Question2Answer platform. |
| 👤 | **Asked&nbsp;By** | CodeCrafter |

Hi,  
I would like to know how it is possible to download files from the internet using GdScript. I would like to use this to add a function to my game that allows you to download updates via the game. I have already found posts about it, but they were a bit older and therefore a class used there no longer worked. Can someone help me there? Thanks in advance.  
CodeCrafter

---

<div class="post-metadata">

**Author:** ![system](https://forum.godotengine.org/uploads/default/original/2X/4/4b0a7fa8a6334634b94a13d421f0d99e6f04e21f.svg) [@system](https://forum.godotengine.org/u/system)\
**Post date:** [September 23, 2021, 11:02pm UTC](https://forum.godotengine.org/t/how-to-download-files-from-the-internet-using-gdscript/8163/2 "2021-09-23T23:02:45Z")

</div>

| | | |
| --- | --- | --- |
| 👤 | **Reply From:** | Wakatta |

You need nothing more than to make an [HTTPRequest](https://docs.godotengine.org/en/stable/classes/class_httprequest.html)

## Example

```
func download(link, path):
    var http = HTTPRequest.new()
    add_child(http)
    http.connect("request_completed", self, "_http_request_completed")

```

```auto
    http.set_download_file(path)
    var request = http.request(link)
    if request != OK:
        push_error("Http request error")

func _http_request_completed(result, _response_code, _headers, _body):
    if result != OK:
        push_error("Download Failed")
    remove_child($HTTPRequest)

func _ready():
    download("https://godotengine.org/themes/godotengine/assets/logo.svg", "Logo.svg")

```

---

<div class="post-metadata">

**Author:** ![system](https://forum.godotengine.org/uploads/default/original/2X/4/4b0a7fa8a6334634b94a13d421f0d99e6f04e21f.svg) [@system](https://forum.godotengine.org/u/system)\
**Post date:** [September 23, 2021, 11:03pm UTC](https://forum.godotengine.org/t/how-to-download-files-from-the-internet-using-gdscript/8163/3 "2021-09-23T23:03:49Z")

</div>

| | | |
| --- | --- | --- |
| 👤 | **Reply From:** | Calinou |

See [Making HTTP requests](https://docs.godotengine.org/en/stable/tutorials/networking/http_request_class.html) in the documentation.

Note that developing a in-game update system has security considerations – you want to make sure files served to players haven’t been tampered with. This is difficult to do right, even for professional game developers. Instead, it’s better to rely on launchers such as Steam or [itch.io](http://itch.io) to perform game updates.

---

<div class="post-metadata">

**Author:** ![HasanHatem](https://forum.godotengine.org/user_avatar/forum.godotengine.org/hasanhatem/32/36417_2.png) [@HasanHatem](https://forum.godotengine.org/u/HasanHatem)\
**Post date:** [January 1, 2025, 8:28am UTC](https://forum.godotengine.org/t/how-to-download-files-from-the-internet-using-gdscript/8163/4 "2025-01-01T08:28:59Z")

</div>

Is there a way to get the downloaded percentage of the file?

---

<div class="post-metadata">

**Author:** ![tt.brbfr](https://forum.godotengine.org/user_avatar/forum.godotengine.org/tt.brbfr/32/71193_2.png) [@tt.brbfr](https://forum.godotengine.org/u/tt.brbfr)\
**Post date:** [January 20, 2025, 6:50pm UTC](https://forum.godotengine.org/t/how-to-download-files-from-the-internet-using-gdscript/8163/5 "2025-01-20T18:50:37Z")

</div>

You could use get\_downloaded\_bytes()
