Mercurial Hosting > luan
diff website/src/examples/chunked.html.luan @ 2008:bba3e529e346 default tip
chunked encoding
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 27 Aug 2025 01:14:17 -0600 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/website/src/examples/chunked.html.luan Wed Aug 27 01:14:17 2025 -0600 @@ -0,0 +1,21 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local range = Luan.range or error() +local Thread = require "luan:Thread.luan" +local sleep = Thread.sleep or error() +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" + + +return function() + Http.response.write_chunked_text(function(writer) + Io.stdout = writer + for i in range(1,10) do +%> +line <%=i%><br> +<% + writer.flush() + sleep(1000) + end + end) +end