I'm using base-x to encode 96-bit random buffers to base 62. But the output length ia not constant because leading zeros are ignored.
I suggest to add an optional boolean parameter to encode: padd.
When true, the function will padd the result with leading zeros until its length is equal to
Math.ceil(bufferLength * 8 / Math.log2(base))
For the example above it'd be equal to 17.
I'm willing to write a PR, but wanted to get feedback on the proposed feature itself.
I'm using base-x to encode 96-bit random buffers to base 62. But the output length ia not constant because leading zeros are ignored.
I suggest to add an optional boolean parameter to
encode
: padd. When true, the function will padd the result with leading zeros until its length is equal toFor the example above it'd be equal to 17.
I'm willing to write a PR, but wanted to get feedback on the proposed feature itself.