HTTPGetFile
Purpose #
Calls a URL and then saves the payload of the HTTP response to a file.
In most cases you will want to use the NFetch function which supersedes the HTTPGetFile function.
This is a synchronous call and hence will block rendering until it completes (which could take hundreds of milliseconds). As such it is usually used at the start of a scene in the first frame.
Only HTTP is supported at this time. Use NFetch function for HTTPS.
Syntax #
void HTTPGetFile(String url, String file_path);
Parameters
file_path | The destination file to create containing the payload. |
url | The url to call. |
Example #
This example pulls a file (a Notch image) from a URL and stores it in your Desktop.
function OnKeyPress(key)
{
Log('Got keypress: ' + key);
if (key == 'P')
{
Log("Getting file");
HTTPGetFile("http://www.notch.one/wp-content/uploads/2017/12/notchlogo-retina_new.png", "C:\\Users\\My Name\\Documents\\Notch_Download.png");
}
}