0
nodejs、しかし、私はこれだけfunction ...ヘックスに文字列をCONVERするためにどのように私は私が六角に文字列をCONVERしたい文字列が、逆の、 に六角のようないくつかのstandar機能を探していました
// example of convert hex to String
hex.toString('utf-8')
nodejs、しかし、私はこれだけfunction ...ヘックスに文字列をCONVERするためにどのように私は私が六角に文字列をCONVERしたい文字列が、逆の、 に六角のようないくつかのstandar機能を探していました
// example of convert hex to String
hex.toString('utf-8')
で見つけましたNodeJS、Bufferを使用して、文字列を16進数に変換します。
Buffer.from('hello world', 'utf8').toString('hex');
あなたは以下のような機能を使用することができます。
function stringToHex(str) {
//converting string into buffer
let bufStr = Buffer.from(str, 'utf8');
//with buffer, you can convert it into hex with following code
bufStr.toString('hex');
}
stringToHex('some string here');