Created
March 17, 2022 00:49
-
-
Save xeecos/d14d1dc5b9224077c3cb4c17d406f8bd to your computer and use it in GitHub Desktop.
bin2array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
let buf = fs.readFileSync("file.bin"); | |
let arr = []; | |
for(let i=0;i<buf.length;i++) | |
{ | |
arr.push('0x'+buf[i].toString(16)); | |
} | |
fs.writeFileSync("file.txt","["+arr.join(",")+"]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment