[erlang-questions] COWBOY

Loïc Hoguin <>
Sat Jan 23 22:01:16 CET 2016


Nothing automatic.

It's like this so you can process on the fly and avoid having a gigabyte 
file in memory.

On 01/23/2016 09:32 PM, Theepan wrote:
> Team,
>
> The following is the code fragment to read the body of a multipart data
> (as per the documentation), when it is the contents of a uploaded file.
>
> stream_file(Req) ->
>    case cowboy_req:part_body(Req) of
>      {ok, Body, Req2} ->
>        {ok, Body, Req2};
>      {more, Body, Req2} ->
>        stream_file(Req2)
>    end.
>
> The question is, when the {more, Body, Req2} case clause is reached,
> should the 'Body' need to get concatenated like <<OldBody/binary,
> Body/binary>>, OR when looped, the library collects the next pieces of
> chunks into the 'Body' automatically?
>
> Thanks,
> Theepan
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang


More information about the erlang-questions mailing list