hex-transcoder
v2.0.0
Published
Fast hex / binary transcoding in pure JavaScript
Downloads
3
Readme
hex-string
Fast hex / binary transcoding in pure JavaScript.
Why
Not as fast as node's implementation, but quite a bit faster than using toString(16)
and parseInt(n, 16)
which is generally what's used in the browser.
On a chromebook, using [email protected]:
$ npm run bench
> [email protected] bench hex-transcoder
> node bench
65536 trials, 16384 bytes per trial
encode (node Buffer): 5.644s
decode (node Buffer): 9.227s
encode (toString): 13.067ms
decode (parseInt): 26.282ms
encode (this module): 14.23ms
decode (this module): 23.725ms
How
Do maths in plain JavaScript.
Test
$ npm run test
Notes
- Tested against node's Buffer for compatibility
- Decode returns
Uint8Array
instead ofBuffer
License
MIT