-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Hello! At Boa (Javascript engine) we were trying to find a good and performant base64 encoding and decoding library to implement the arraybuffer-base64 proposal. We stumbled upon this library which looked really nice, but we encountered some limitations on its available encoding options. I'll let @magic-akari's comment speak for itself:
The main missing feature is LastChunkHandlingOptions. Currently, data-encoding only offers two padding modes: None and Some, both of which enforce strict padding validation.
However, the ECMA-262 spec requires three distinct modes: strict("="), loose("="), and StopBeforePartial.
Our current implementation works around this limitation by checking for the presence of = in the input beforehand to toggle between Some("=") and None. Having native loose("=") support in data-encoding would eliminate this hack.
There's another subtle issue: ECMA-262 disallows concatenated padded inputs, but data-encoding with padding enabled accepts them. A proper loose mode shouldn't just be a binary switch—it needs to reject concatenated padded inputs to match the spec.
We're open to help implement those missing features, but we wanted to ask first if those didn't conflict with any plans for the development of this library. Thank you!