JS Hex
hexString = yourNumber.toString(16);
Awesomered989
hexString = yourNumber.toString(16);
yourNumber = parseInt(hexString, 16);
const myString = "This is my string to be encoded/decoded";
const encoded = new Buffer(myString).toString('hex'); // encoded === 54686973206973206d7920737472696e6720746f20626520656e636f6465642f6465636f646564
const decoded = new Buffer(encoded, 'hex').toString(); // decoded === "This is my string to be encoded/decoded"