Can you run JavaScript code with Godot?

Godot Version

4.0

Question

Hi, I would like to create a program that uploads files to GitHub. I managed to do it using JavaScript. However, I can’t figure out how to do it with GDscript. So, I would like to run the JavaScript code on Godot. I don’t know if that is possible. If it is not, could anyone tell me how do make the program that uploads files using GDscript?

This use-case is documented here:

But I don’t want to export my game to the web

There do exist projects that you can use for allowing you to use Godot with Javascript. I’ve not used them personally, you can find them here - GitHub - Geequlim/ECMAScript: Javascript binding for godotengine

However, if you only want to have Godot run JavaScript, then you could export the game “for web”. This exports it into an HTML page that you could convert to an exe file, there are a number of projects that could do that.

If you were to do that, you could use the JavaScriptBridge and Objects here - JavaScriptObject — Godot Engine (stable) documentation in English

You can’t use JavaScript in Godot unless it’s exported for the Web. You may be able to use it as an scripting language but it won’t have support for uploading files. That’s not a language feature but an implementation.

You can upload files directly with HTTPRequest but you’ll need to create the http request payload by hand.

You can try this plugin Godot 4 - HTTPManager - Godot Asset Library which seems to do that for you and has support for uploading files.

Do you know how to upload the file using GDscript directly?

Thank you :slight_smile: