anchor.diff:  -define(MAX_DOWNLOAD_BUFFER_SIZE, application:get_env(
       ?APP_NAME, max_download_buffer_size, 20971520) % 20 MB
   ).
  --define(SEND_RETRY_DELAY, 100).
  +
  +% TODO VFS-6597 - update cowboy to at least ver 2.7 to fix streaming big files
  +% Due to lack of backpressure mechanism in cowboy when streaming files it must
  +% be additionally implemented. This module implementation checks cowboy process
  +% msg queue len to see if next data chunk can be queued. To account for
  +% differences in speed between network and storage a simple backoff is
  +% implemented with below boundaries.
  +-define(MIN_SEND_RETRY_DELAY, 100).
  +-define(MAX_SEND_RETRY_DELAY, 1000).
   
   
   %%%===================================================================
  
positive.code:         0 ->
              ok;
          DataSize ->
              send_data(EncodingFun(Data), Req, MaxReadBlocks),
              stream_range(
                  NewFileHandle, {From + DataSize, To}, Req,
                  EncodingFun, ReadBlockSize, MaxReadBlocks
              )
      end.
  
  
negative.code:     cowboy_req:req(),
      EncodingFun :: fun((Data :: binary()) -> EncodedData :: binary()),
      ReadBlockSize :: non_neg_integer(),
      MaxReadBlocks :: non_neg_integer(),
      SendRetryDelay :: non_neg_integer()
  ) ->
      ok | no_return().
  stream_range(_, {From, To}, _, _, _, _, _) when From > To ->
      ok;
  stream_range(
      FileHandle, {From, To}, Req, EncodingFun,
      ReadBlockSize, MaxReadBlocks, SendRetryDelay
  ) ->
      ToRead = min(To - From + 1, ReadBlockSize - From rem ReadBlockSize),
      {ok, NewFileHandle, Data} = ?check(lfm:read(FileHandle, From, ToRead)),
  
  