package
Fast hex / binary transcoding in pure JavaScript
npm install hex-transcoderGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
4.8 kB
Includes dependencies.
Fast hex / binary transcoding in pure JavaScript.
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 node@14.6.0:
$ npm run bench
> hex-transcoder@2.0.0 bench hex-transcoder
> node bench
65536 trials, 16384 bytes per trial (v25.9.0)
encode (node Buffer): 99.945ms
decode (node Buffer): 601.284ms
encode (toString): 0.407ms
decode (parseInt): 1.744ms
encode (this module): 0.304ms
decode (this module): 1.555msDo maths in plain JavaScript.
$ npm run testUint8Array instead of BufferMIT