如何在不破坏使用 ajax 的编码的情况下查看加密的 bin 文件?

how can i view an encrypted bin file without breaking it's encoding using ajax?

代码

var xhr0 = new XMLHttpRequest();
xhr0.open("get", 'page/file.bin', true);
xhr0.onreadystatechange = function() {
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
        console.log("data:")
        console.log(xhr0.response)

        }
}
xhr0.send();

页面

的响应之一 headers
Content-Type: application/x-download;charset=ISO-8859-1

虽然我无法确定文件的确切编码,因为它是加密的。 我需要像查看文件一样查看文件..二进制(十六进制视图)。

通过使用 response type

就这样

var xhr0 = new XMLHttpRequest();
xhr0.open("get", 'page.bin', true);
xhr0.responseType =  "blob";
xhr0.onreadystatechange = function() {
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
        console.log("data:")
        var blob1 = xhr0.response
        console.log(blob1)
            }
}
xhr0.send();

它看起来像这样 image