Skip to content

Instantly share code, notes, and snippets.

@evanmiller
Created July 22, 2012 00:30
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 evanmiller/3157712 to your computer and use it in GitHub Desktop.
Save evanmiller/3157712 to your computer and use it in GitHub Desktop.
-module(testproj_test_controller, [Req]).
-compile(export_all).
csv('GET', []) ->
{stream, fun
(first_line) ->
{output, "var1,var2,var3\n", 0};
(100) ->
done;
(N) when is_integer(N) ->
timer:sleep(100),
{output, io_lib:format("~p,~p,~p\n", [N, N, N]), N + 1}
end, first_line, [{"Content-Type", "text/comma-separated-values"}]}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment