From d1b5143e34ecb0a5ac818a1e81bb90e870241cbe Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Tue, 20 Feb 2024 18:55:41 -0800 Subject: [PATCH] stage 3! --- README.md | 4 ++-- playground/index-raw.html | 4 ++-- spec.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1d44c68..29ca54c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ base64 is a common way to represent arbitrary binary data as ASCII. JavaScript has Uint8Arrays to work with binary data, but no built-in mechanism to encode that data as base64, nor to take base64'd data and produce a corresponding Uint8Arrays. This is a proposal to fix that. It also adds methods for converting between hex strings and Uint8Arrays. -It is currently at Stage 2 of [the TC39 process](https://tc39.es/process-document/). +It is currently at stage 3 of [the TC39 process](https://tc39.es/process-document/): it is ready for implementations. See [this issue](https://github.com/tc39/proposal-arraybuffer-base64/issues/51) for current status. Try it out on [the playground](https://tc39.github.io/proposal-arraybuffer-base64/). @@ -36,7 +36,7 @@ Additional options are supplied in an options bag argument: - `alphabet`: Allows specifying the alphabet as either `base64` or `base64url`. -- `lastChunkHandling`: Recall that base64 decoding operates on chunks of 4 characters at a time, but the input maybe have some characters which don't fit evenly into such a chunk of 4 characters. This option determines how the final chunk of characters should be handled. The three options are `"loose"` (the default), which treats the chunk as if it had any necessary `=` padding (but throws if this is not possible, i.e. there is exactly one extra character); `"strict"`, which enforces that the chunk has exactly 4 characters (counting `=` padding) and that [overflow bits](https://datatracker.ietf.org/doc/html/rfc4648#section-3.5) are 0; and `"stop-before-partial"`, which stops decoding before the final chunk unless the final chunk has exactly 4 characters. +- `lastChunkHandling`: Recall that base64 decoding operates on chunks of 4 characters at a time, but the input may have some characters which don't fit evenly into such a chunk of 4 characters. This option determines how the final chunk of characters should be handled. The three options are `"loose"` (the default), which treats the chunk as if it had any necessary `=` padding (but throws if this is not possible, i.e. there is exactly one extra character); `"strict"`, which enforces that the chunk has exactly 4 characters (counting `=` padding) and that [overflow bits](https://datatracker.ietf.org/doc/html/rfc4648#section-3.5) are 0; and `"stop-before-partial"`, which stops decoding before the final chunk unless the final chunk has exactly 4 characters. The hex methods do not take any options. diff --git a/playground/index-raw.html b/playground/index-raw.html index f8dfa3e..36cc439 100644 --- a/playground/index-raw.html +++ b/playground/index-raw.html @@ -49,7 +49,7 @@

Proposed Support for Base64 in JavaScript

Introduction

-

This page documents a stage-2 proposal for native base64 and hex encoding and decoding for binary data in JavaScript, and includes a non-production polyfill you can experiment with in the browser's console.

+

This page documents a stage 3 proposal for native base64 and hex encoding and decoding for binary data in JavaScript, and includes a non-production polyfill you can experiment with in the browser's console.

The proposal would provide methods for encoding and decoding Uint8Arrays as base64 and hex strings.

Feedback on the proposal's repository is appreciated.

Specification text for the proposal is available here.

@@ -86,7 +86,7 @@

Basic usage

Options

The base64 methods take an optional options bag which allows specifying the alphabet as either "base64" (the default) or "base64url" (the URL-safe variant).

-

The base64 decoder also allows specifying the behavior for the final chunk with lastChunkHandling. Recall that base64 decoding operates on chunks of 4 characters at a time, but the input maybe have some characters which don't fit evenly into such a chunk of 4 characters. This option determines how the final chunk of characters should be handled. The three options are "loose" (the default), which treats the chunk as if it had any necessary = padding (but throws if this is not possible, i.e. there is exactly one extra character); "strict", which enforces that the chunk has exactly 4 characters (counting = padding) and that overflow bits are 0; and "stop-before-partial", which stops decoding before the final chunk unless the final chunk has exactly 4 characters. +

The base64 decoder also allows specifying the behavior for the final chunk with lastChunkHandling. Recall that base64 decoding operates on chunks of 4 characters at a time, but the input may have some characters which don't fit evenly into such a chunk of 4 characters. This option determines how the final chunk of characters should be handled. The three options are "loose" (the default), which treats the chunk as if it had any necessary = padding (but throws if this is not possible, i.e. there is exactly one extra character); "strict", which enforces that the chunk has exactly 4 characters (counting = padding) and that overflow bits are 0; and "stop-before-partial", which stops decoding before the final chunk unless the final chunk has exactly 4 characters.

The hex methods do not have any options.


diff --git a/spec.html b/spec.html
index a4c176e..b644cd1 100644
--- a/spec.html
+++ b/spec.html
@@ -3,7 +3,7 @@