MCPcopy Create free account
hub / github.com/wevm/viem / hexToString

Function hexToString

src/utils/encoding/fromHex.ts:260–267  ·  view source on GitHub ↗
(hex: Hex, opts: HexToStringOpts = {})

Source from the content-addressed store, hash-verified

258 * // 'Hello world'
259 */
260export function hexToString(hex: Hex, opts: HexToStringOpts = {}): string {
261 let bytes = hexToBytes(hex)
262 if (opts.size) {
263 assertSize(bytes, { size: opts.size })
264 bytes = trim(bytes, { dir: 'right' })
265 }
266 return new TextDecoder().decode(bytes)
267}

Callers 3

fromHex.test.tsFile · 0.85
fromHex.bench.tsFile · 0.85
fromHexFunction · 0.85

Calls 3

hexToBytesFunction · 0.85
assertSizeFunction · 0.85
trimFunction · 0.85

Tested by

no test coverage detected