Created
December 8, 2017 00:20
-
-
Save cablehead/4f460c19fdc808e92471aa2d0a61da7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local levee = require("levee") | |
local _ = levee._ | |
local h = levee.Hub() | |
local r, w = h.io:pipe() | |
h:spawn(function() | |
for i = 1, 1000 do | |
local s = tostring(i):rep(i) | |
w:write(s) | |
end | |
w:close() | |
end) | |
local buf = levee.d.Buffer(4096) | |
while true do | |
buf:ensure() | |
local err, n = r:read(buf.buf + buf.len, buf.cap - buf.len) | |
if err then break end | |
buf.len = buf.len + n | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment