StreamURL
result = StreamURL(url)
Input: url · Output: result
What it is
url (string, an HTTP or HTTPS URL) is fetched eagerly with a GET request (same request http_get makes: GET only, 30s timeout, clear errors on an unreachable host or non-2xx status โ see [Networking (HTTP)](concurrency.md#networking-http)).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = StreamURL(url) | url stringnot documented yet | result — | Returns an opaque stream handle wrapping the whole response body in a read-only, in-memory cursor exposing read_line/read_all/eof/close. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
n = fopen("notes.txt", "w")
write_line(n, "line one")
write_line(n, "line two")
close(n)
function drain(s)
total = ""
while not eof(s)
total = total + read_line(s) + "|"
end while
close(s)
return total
end function
a = drain(StreamFile("notes.txt"))
print(a) # line one|line two|
b = drain(StreamURL("https://example.com/"))
print(length(b) > 0) # true -- some HTML came back
line one|line two| true
from file-io
function drain(s)
total = ""
while not eof(s)
total = total + read_line(s) + "|"
end while
close(s)
return total
end function
# Written here so the file half runs; the URL half cannot be, since a
# documentation build must not depend on the network being up or on a
# third party's page not changing under it.
w = fopen("stream_notes.txt", "w")
write_line(w, "one")
write_line(w, "two")
close(w)
a = drain(StreamFile("stream_notes.txt"))
b = drain(StreamURL("https://example.com/"))
print("a = {a}")
print("b length = {length(b)}")
from tour
How it works
that module's own doc comment for the return shape (always Value::Str), timeout (fixed 30s), and error conventions. StreamURL(url) (ยง StreamFile/StreamURL polymorphic streams, 2026-08-31) โ see net_ops::stream_url's own doc comment.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.