[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Download only part of a file using LuaSocket HTTP
- From: Ignacio Burgueño <ignaciob@...>
- Date: Fri, 30 Jan 2009 19:07:39 -0200
RJP Computing wrote:
I tested this and the server doesn't support it. Any other way to use a
sink and then cancel after enough chunks have been received? Does anyone
have an example of this? Thanks.
Maybe something along these lines:
require"luarocks.require"
local http = require "socket.http"
print(http.request{
url = "http://lua-users.org/wiki/FiltersSourcesAndSinks",
sink = function(chunk, err)
if chunk then
print("got a chunk of length", #chunk)
-- process chunk and return nil when you don't want to process more
chunks
end
return 1
end
})
--
Regards,
Ignacio Burgueño