Skip to content

Commit

Permalink
BREAKING(encoding/unstable): move base64-stream module to `unstable…
Browse files Browse the repository at this point in the history
…-base64-stream` (#5958)
  • Loading branch information
iuioiua authored Sep 12, 2024
1 parent 034f3d7 commit 0ff29d1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions _tools/check_docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const ENTRY_POINTS = [
"../datetime/mod.ts",
"../dotenv/mod.ts",
"../encoding/mod.ts",
"../encoding/unstable_base64_stream.ts",
"../encoding/unstable_base32hex_stream.ts",
"../encoding/unstable_base32_stream.ts",
"../expect/mod.ts",
Expand Down
2 changes: 1 addition & 1 deletion encoding/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"./unstable-base32hex-stream": "./unstable_base32hex_stream.ts",
"./base58": "./base58.ts",
"./base64": "./base64.ts",
"./base64-stream": "./base64_stream.ts",
"./unstable-base64-stream": "./unstable_base64_stream.ts",
"./base64url": "./base64url.ts",
"./base64url-stream": "./base64url_stream.ts",
"./hex": "./hex.ts",
Expand Down
1 change: 0 additions & 1 deletion encoding/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export * from "./base32.ts";
export * from "./base32hex.ts";
export * from "./base58.ts";
export * from "./base64.ts";
export * from "./base64_stream.ts";
export * from "./base64url.ts";
export * from "./base64url_stream.ts";
export * from "./hex.ts";
Expand Down
16 changes: 14 additions & 2 deletions encoding/base64_stream.ts → encoding/unstable_base64_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
/**
* 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.
*
* @module
Expand All @@ -22,7 +34,7 @@ import { decodeBase64, encodeBase64 } from "./base64.ts";
* ```ts
* import { assertEquals } from "@std/assert";
* 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";
*
* const stream = ReadableStream.from(["Hello,", " world!"])
Expand Down Expand Up @@ -66,7 +78,7 @@ export class Base64EncoderStream extends TransformStream<Uint8Array, string> {
* @example Usage
* ```ts
* 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";
*
* const stream = ReadableStream.from(["SGVsbG8s", "IHdvcmxkIQ=="])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import { assertEquals } from "@std/assert";
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 { toText } from "@std/streams/to-text";
import { concat } from "@std/bytes/concat";
Expand Down

0 comments on commit 0ff29d1

Please sign in to comment.