Your callback function should return the number of bytes it handled, e.g. c:setopt(curl.OPT_WRITEFUNCTION, function(userparam, buffer) f:write(buffer); return #buffer end) - Jeff