[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: decompressing a http stream
- From: Natanael Copa <natanael.copa@...>
- Date: Mon, 29 Mar 2010 16:42:13 +0200
Hi,
So, I have this code:
f = io.popen("wget -q -O - "..gzurl.." | gunzip -c")
for line in f:lines() do
-- process line here
end
Clean, and simple. Not so beautiful. So i thought I'd have a look at
lzlib and luasocket to do the same. I'd expect something in the lines:
s = socket.http.open(gzurl)
f = zlib.inflate(s)
for line in f:lines()
-- process line here
end
But thats obviously not how socket.http works. I need sinks, and
chains and pumps? I cannot even use socket.tcp for this which does not
give me a "file handle" either.
Any one have a link to an example how to do things like that?
One key point here is that the memory is limited and file is big so i
cannot download entire file to ram and process it afterwards. (And I
also want use the time waiting for data over slow lines doing
something useful)
Thanks!
--
Natanael Copa