The new implementation works on large inputs, this was tested up to 128MiB on Node.js 22 with no issues.
The Erlang implementation also now gets base64:encode to add the padding to the returned string if it's requested, which optimises away a string.replace when padding isn't desired.
Fixes #642.
This replaces the implementation of Base64 encoding with a native JS implementation that is significantly faster, 13-14x in my benchmarks. It's based on https://github.com/mitschabaude/fast-base64/blob/main/js.js.
The new implementation works on large inputs, this was tested up to 128MiB on Node.js 22 with no issues.
The Erlang implementation also now gets
base64:encode
to add the padding to the returned string if it's requested, which optimises away astring.replace
when padding isn't desired.