fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Idiom # 102: Load from HTTP GET request into a file

See programming-idioms.org:

Code

web.get6 sends a GET request to u using IPv6 and returns the body of the response. To connect via IPv4, use web.get4.

web.get6 returns an outcome String. Using bind, the body is passed to io.file.write if the request was successful. io.file.write creates the file result.txt and writes the body to it. The result r is of type outcome unit: it is an error if either the request or writing the file failed.

Runnable Example

This example cannot be run online since it requires network access. Module web is not part of the base library, and HTTPS requires the native TLS library wolfSSL to be installed, so the example is run as follows:

fz -jvm -modules=web -JLibraries=wolfssl idiom102ex.fz
last changed: 2026-10-14