Base64
Base64 copied to clipboard
Add support for RFC 4648 compatible URL-safe encoding
Hi j.n. thanks for the pull request.
I think the URL-safe encoding could actually be more simply implemented as a post-processing step (find and replace of + and / with - and _ respectively after conversion).
Can you explain what the use case for the noPad option is?
OK I read RFC4648 and it explains why you might want to strip the padding.
Hi Nick, As replacing the characters as a post-processing step would require another loop for string processing, I wanted to improve efficiency by avoiding the (negligible) overhead. The noPad option prevents the encoder from adding the padding character (=). But as this option might not be that useful, it should just depend on the urlSafe option.
regards, Niklas
Thank you, that makes sense.
I'd like to change the interface a bit and I'm not happy with the duplication of the lookup table (not very DRY) so I'd like to do some performance tests to see if the benefit is significant, but I'll look into implementing equivalent functionality in the next release. Thanks again.