feat(std/encoding): add ascii85 module #6711
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Custom implementation of ascii85 supporting multiple standards. Defaults to Adobe variant with no delimeter, since it's used by the Go standard library implementation (and probably most popular).
Additionally it can use btoa version, which can compress a couple characters more (four "spaces", that is bytes equal to 32, compress into a single "y" character), though there is no support for checksums added by btoa program at the end of a message with delimeters.
Since both of these can be hard to use in a string literal - since their characterset contains characters that need to be escaped (for example both quotation mark characters -
'
and"
) there are also two standards that should be safer to use - Z85 and RFC 1924 (while it's an April Fools' Day RFC and the standard is not the best idea for storing IPv6, the characterset used by this encoding is better for use in string literals since it excludes characters that might need to be escaped in JS/TS).There is also support for adding delimeters in the
encode
function -<~
and~>
for Adobe variant andxbota Begin
andxbtoa End
for btoa. Other standards don't define any delimeter, so none is used even if the option is specified.