Ajax requests backend, and the backend returns binary data. How should JS be parsed?

background code snippet:

UtilHttp.streamContentToBrowser(response, UtilObject.getBytes(list), "application/octet-stream");

background list:

clipboard.png

listbyte[],ioJS
Ajax:


dataType: "text":

clipboard.png

...

XMLHttpRequest


byteArray: list

clipboard.png


returns the data as buffer with the native XMLHttpRequest, setting


the backend is jokingly identified, and the binary stream may be text, the video may be how to parse the picture.


returns data like java.util ? Is it dead when you go back backstage? (well, you can press the backstage to rub it on the ground. )


you can get the file directly without using the ajax call in the previous paragraph
or use the Blob object in the previous paragraph

ask this question in the previous paragraph


(the type you received is not text)

  • stream returns buffer, not Array
    , so the front end receives ArrayBuffer
    instead of a normal array
  • convert ArrayBuffer to string toString,
    JSON.parse to json object, which should be the list data you want
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e42006-44981.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e42006-44981.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?