You got some hex numbers as strings without the prefix, and you want to write them as bytes to a file. Because there are currently no byte implementations in javascript, you will have to convert each byte to its corresponding char and then write to your file.
var data = new Array("0A", "31", "55", "AA", "FF"), file = "";
//turn hex string to number, then convert it to string and append to file
file += data.map(hex => String.fromCharCode(+("0x"+hex))).join("")
//byte file back to hex array
data = file.split("").map(ch => ("0"+ch.charCodeAt(0).toString(16).toUpperCase()).slice(-2))