load byte file into array via TWebHttpRequest get

I can't get any further in my attempt to load a serial file (all data bytes) into an array in my programme via webrequest Get.

As long as I address a text file, everything works fine.
But I can't get the byte file into an array.

Textfile

procedure Tfm_Start.whtWebUCDataResponse(Sender: TObject; AResponse: string);
begin
  Memo1.Lines.Add(AResponse);
end;

procedure Tfm_Start.bt_TrendLoadClick(Sender: TObject);
begin
  whtWebUCData.URL := 'TrendLog/Trend3.dlo';
  whtWebUCData.ResponseType := rtText;

  whtWebUCData.Execute;
end;

SeriellesFile

procedure Tfm_Start.whtWebUCDataResponse(Sender: TObject; AResponse: string);
var
  i : integer;
begin

  cast TJSArrayBuffer to byteArray ...
   
  for i := 0 to (SizeOf(byteArray)-1) do
    Memo1.Lines.Add(IntToStr(byteArray[i]) 
end;

procedure Tfm_Start.bt_TrendLoadClick(Sender: TObject);
begin
  whtWebUCData.URL := 'TrendLog/Trend1.dlo';
  whtWebUCData.ResponseType := rtArrayBuffer;

  whtWebUCData.Execute;
end;

I have tried different approaches, but somehow the cast to the TJSArrayBuffer does not work.

Here is another statement from you regarding the problem:
If you use TWebHttpRequest, set ResponseType to rtArrayBuffer and then perform a GET request.
Then, in the OnRequestResponse event handler, you should be able to cast the ARequest.req.response to a TJSArrayBuffer and use this data returned.

Try

procedure TForm3.WebHttpRequest1RequestResponse(Sender: TObject;
  ARequest: TJSXMLHttpRequestRecord; AResponse: string);
var
  ja: TJSArrayBuffer;
begin
  ja := TJSArrayBuffer(ARequest.req.response);
end;

I tried it all the time via WebHttpRequest -> OnResponse and
not via WebHttpRequest -> OnRequestResponse.

Now it works