Interactive Lab

Native Binary Buffers & Container Layouts

Stream byte transformations using ES2026 Uint8Array APIs inside adaptive Tailwind v4 container query cards.

binary-and-containers.ts
// ES2026: Native Uint8Array Base64 & Streaming Async Collection
const encoder = new TextEncoder();
const bytes = encoder.encode("Modern Web Architecture 2026");

// Native binary serialization (no external btoa/Buffer polyfills)
const base64String = bytes.toBase64();

// Streaming async iterator into an aggregated array
async function* generateChunks() {
  yield Promise.resolve(bytes.subarray(0, 6));
  yield Promise.resolve(bytes.subarray(6, 12));
}

const chunks = await Array.fromAsync(generateChunks());

Architectural Features

  • Uint8Array.prototype.toBase64(): Native binary serialization without polyfill overhead.
  • Array.fromAsync(): Streams promises and async iterables directly into an array.
  • Container Queries: Modular layout changes driven by element container width.
Container Query Tester
// @container adaptive layout card
Allocated Bytes

28 B

Base64 Length

40 Chars

Uint8Array Base64 Output:

TW9kZXJuIFdlYiBBcmNoaXRlY3R1cmUgMjAyNg==