Skip to content

Instantly share code, notes, and snippets.

@chrisabruce
Created September 7, 2008 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisabruce/9339 to your computer and use it in GitHub Desktop.
Save chrisabruce/9339 to your computer and use it in GitHub Desktop.
save_data(FileIo, Req, Length) when Length > 0 ->
case Length of
Length when Length < ?CHUNKSIZE ->
Chunk = Req:recv(Length);
_ ->
Chunk = Req:recv(?CHUNKSIZE)
end,
file:write(FileIo, Chunk),
Length1 = Length - size(Chunk),
save_data(FileIo, Req, Length1);
save_data(FileIo, Req, Length) -> {ok}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment