tonhowtf/omniget · error · Error
CompressionStream indisponível neste runtime
Error message
CompressionStream indisponível neste runtime
What it means
Capability guard in compressForUrl: the globalThis.CompressionStream API is missing in the current runtime (older browser or non-secure context), so the PlantUML text cannot be deflate-compressed for an encoded server URL.
Solutions
- Feature-detect CompressionStream before offering the encoded-URL rendering path
- Fall back to sending the raw (uncompressed) PlantUML source to the server
- Polyfill CompressionStream (e.g. via a wasm deflate implementation) for runtimes that lack it
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at src/lib/study-components/notes/PlantumlView.svelte:119 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/b0af1f7e0e2ddeaa.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/study-components/notes/PlantumlView.svelte:119
const c1 = b1 >> 2;
const c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
const c3 = ((b2 & 0xf) << 2) | (b3 >> 6);
const c4 = b3 & 0x3f;
result +=
PLANT_ALPHABET[c1 & 0x3f] +
PLANT_ALPHABET[c2 & 0x3f] +
PLANT_ALPHABET[c3 & 0x3f] +
PLANT_ALPHABET[c4 & 0x3f];
}
return result;
}
async function compressForUrl(text: string): Promise<string> {
const G = globalThis as unknown as {
CompressionStream?: new (format: string) => GenericTransformStream;
};
if (!G.CompressionStream) {
throw new Error("CompressionStream indisponível neste runtime");
}
const ds = new G.CompressionStream("deflate-raw");
const stream = new Blob([text]).stream().pipeThrough(ds);
const compressed = await new Response(stream).arrayBuffer();
return deflateBase64(new Uint8Array(compressed));
}
async function renderRemote(src: string) {
const token = ++renderToken;
const trimmed = src.trim();
if (!trimmed) return;
renderState = { kind: "remote-rendering" };
try {
const encoded = await compressForUrl(trimmed);
if (token !== renderToken) return;
const url = `https://www.plantuml.com/plantuml/svg/~1${encoded}`;
const resp = await fetch(url);
if (!resp.ok) {View on GitHub (pinned to 8600b91f42)