Как то так
<body>
<script>
const sampleXStr = '2d60a05493265733ff38002c9b80d359ddd9707f98f1c72ce38f08fbb057e6ee';
const xStrtoBinArr = (data) => {
data = data.padStart(((data.length/2+0.5)|0)*2, '0')
const len = data.length;
const arr = [];
for (let i=0; i<len; i+=2) {
const x = data[i]+data[i+1]
arr.push(parseInt(x,16));
}
return arr;
}
const saveBitArray = function (data, filename) {
const binar = xStrtoBinArr(data);
const buffer = new ArrayBuffer(binar.length);
let bindata = new Uint8Array(buffer);
for (let i=0; i<binar.length; i++)
bindata[i] = binar[i];
const a = document.createElement("a");
a.download = filename;
document.body.append(a);
a.style = "display: none";
const blob = new Blob([buffer], {type: "octet/stream"});
const url = window.URL.createObjectURL(blob);
a.href = url;
a.click();
window.URL.revokeObjectURL(url);
a.remove();
};
saveBitArray(sampleXStr, 'examplebin');
</script>
</body>