[erlang-questions] COWBOY

Theepan vasdeveloper@REDACTED
Sat Jan 23 21:32:38 CET 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160124/1f8e8508/attachment.htm>


More information about the erlang-questions mailing list