anchor.diff:      fold_streamed_data(RcvFun, LenLeft - size(Bin), Fun, ResultAcc).
   
   len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, SendEncodedAtts) ->
  -    AttsSize = lists:foldl(fun(#att{data=Data} = Att, AccAttsSize) ->
  +    AttsSize = lists:foldl(fun(Att, AccAttsSize) ->
  +            #att{
  +                data=Data,
  +                name=Name,
  +                att_len=AttLen,
  +                disk_len=DiskLen,
  +                type=Type,
  +                encoding=Encoding
  +            } = Att,
               case Data of
               stub ->
                   AccAttsSize;
  
positive.code:                 AccAttsSize +
                  4 + % "\r\n\r\n"
                  case SendEncodedAtts of
                  true ->
                      Att#att.att_len;
                  _ ->
                      Att#att.disk_len
                  end +
                  4 + % "\r\n--"
                  size(Boundary)
              end
          end, 0, Atts),
      if AttsSize == 0 ->
  
negative.code:     atts_to_mp(RestAtts, Boundary, WriteFun, SendEncodedAtts);
  atts_to_mp([Att | RestAtts], Boundary, WriteFun,
          SendEncodedAtts)  ->
      #att{
          name=Name,
          att_len=AttLen,
          disk_len=DiskLen,
          type=Type,
          encoding=Encoding
      } = Att,
  
      % write headers
      LengthBin = case SendEncodedAtts of
      true -> list_to_binary(integer_to_list(DiskLen));
      false -> list_to_binary(integer_to_list(AttLen))
      end,
      WriteFun(<<"\r\nContent-Disposition: attachment; filename=\"", Name/binary, "\"">>),
      WriteFun(<<"\r\nContent-Type: ", Type/binary>>),
      WriteFun(<<"\r\nContent-Length: ", LengthBin/binary>>),
      case Encoding of
      identity ->
          ok;
      _ ->
          EncodingBin = atom_to_binary(Encoding, latin1),
          WriteFun(<<"\r\nContent-Encoding: ", EncodingBin/binary>>)
      end,
  
      % write data
      WriteFun(<<"\r\n\r\n">>),
      AttFun = case SendEncodedAtts of
      false ->
  