Hex To Buffer
NodeJS
Medium
3 views
Problem Description
Read a hex string and print the utf8 text.
Input Format
stdin: one hex string.
Output Format
Print utf8.
Constraints
Assume valid hex.
Official Solution
const fs = require('fs');
const hex = fs.readFileSync(0, 'utf8').trim();
if (!hex) process.exit(0);
const buf = Buffer.from(hex, 'hex');
console.log(buf.toString('utf8'));
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!