BREAKING(encoding/unstable): move base64-stream module to unstable-base64-stream (#5958)

This commit is contained in:
Asher Gomez 2024-09-12 15:51:34 +10:00 committed by GitHub
parent 034f3d75d3
commit 0ff29d1508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 5 deletions

View File

@ -45,6 +45,7 @@ const ENTRY_POINTS = [
"../datetime/mod.ts", "../datetime/mod.ts",
"../dotenv/mod.ts", "../dotenv/mod.ts",
"../encoding/mod.ts", "../encoding/mod.ts",
"../encoding/unstable_base64_stream.ts",
"../encoding/unstable_base32hex_stream.ts", "../encoding/unstable_base32hex_stream.ts",
"../encoding/unstable_base32_stream.ts", "../encoding/unstable_base32_stream.ts",
"../expect/mod.ts", "../expect/mod.ts",

View File

@ -10,7 +10,7 @@
"./unstable-base32hex-stream": "./unstable_base32hex_stream.ts", "./unstable-base32hex-stream": "./unstable_base32hex_stream.ts",
"./base58": "./base58.ts", "./base58": "./base58.ts",
"./base64": "./base64.ts", "./base64": "./base64.ts",
"./base64-stream": "./base64_stream.ts", "./unstable-base64-stream": "./unstable_base64_stream.ts",
"./base64url": "./base64url.ts", "./base64url": "./base64url.ts",
"./base64url-stream": "./base64url_stream.ts", "./base64url-stream": "./base64url_stream.ts",
"./hex": "./hex.ts", "./hex": "./hex.ts",

View File

@ -20,7 +20,6 @@ export * from "./base32.ts";
export * from "./base32hex.ts"; export * from "./base32hex.ts";
export * from "./base58.ts"; export * from "./base58.ts";
export * from "./base64.ts"; export * from "./base64.ts";
export * from "./base64_stream.ts";
export * from "./base64url.ts"; export * from "./base64url.ts";
export * from "./base64url_stream.ts"; export * from "./base64url_stream.ts";
export * from "./hex.ts"; export * from "./hex.ts";

View File

@ -4,6 +4,18 @@
/** /**
* Utilities for encoding and decoding to and from base64 in a streaming manner. * Utilities for encoding and decoding to and from base64 in a streaming manner.
* *
* ```ts
* import { assertEquals } from "@std/assert";
* import { Base64DecoderStream } from "@std/encoding/unstable-base64-stream";
* import { toText } from "@std/streams/to-text";
*
* const stream = ReadableStream.from(["SGVsbG8s", "IHdvcmxkIQ=="])
* .pipeThrough(new Base64DecoderStream())
* .pipeThrough(new TextDecoderStream());
*
* assertEquals(await toText(stream), "Hello, world!");
* ```
*
* @experimental **UNSTABLE**: New API, yet to be vetted. * @experimental **UNSTABLE**: New API, yet to be vetted.
* *
* @module * @module
@ -22,7 +34,7 @@ import { decodeBase64, encodeBase64 } from "./base64.ts";
* ```ts * ```ts
* import { assertEquals } from "@std/assert"; * import { assertEquals } from "@std/assert";
* import { encodeBase64 } from "@std/encoding/base64"; * import { encodeBase64 } from "@std/encoding/base64";
* import { Base64EncoderStream } from "@std/encoding/base64-stream"; * import { Base64EncoderStream } from "@std/encoding/unstable-base64-stream";
* import { toText } from "@std/streams/to-text"; * import { toText } from "@std/streams/to-text";
* *
* const stream = ReadableStream.from(["Hello,", " world!"]) * const stream = ReadableStream.from(["Hello,", " world!"])
@ -66,7 +78,7 @@ export class Base64EncoderStream extends TransformStream<Uint8Array, string> {
* @example Usage * @example Usage
* ```ts * ```ts
* import { assertEquals } from "@std/assert"; * import { assertEquals } from "@std/assert";
* import { Base64DecoderStream } from "@std/encoding/base64-stream"; * import { Base64DecoderStream } from "@std/encoding/unstable-base64-stream";
* import { toText } from "@std/streams/to-text"; * import { toText } from "@std/streams/to-text";
* *
* const stream = ReadableStream.from(["SGVsbG8s", "IHdvcmxkIQ=="]) * const stream = ReadableStream.from(["SGVsbG8s", "IHdvcmxkIQ=="])

View File

@ -2,7 +2,10 @@
import { assertEquals } from "@std/assert"; import { assertEquals } from "@std/assert";
import { encodeBase64 } from "./base64.ts"; import { encodeBase64 } from "./base64.ts";
import { Base64DecoderStream, Base64EncoderStream } from "./base64_stream.ts"; import {
Base64DecoderStream,
Base64EncoderStream,
} from "./unstable_base64_stream.ts";
import { RandomSliceStream } from "./_random_slice_stream.ts"; import { RandomSliceStream } from "./_random_slice_stream.ts";
import { toText } from "@std/streams/to-text"; import { toText } from "@std/streams/to-text";
import { concat } from "@std/bytes/concat"; import { concat } from "@std/bytes/concat";