MCPcopy Create free account
hub / github.com/backnotprop/plannotator / compress

Function compress

packages/shared/crypto.test.ts:14–22  ·  view source on GitHub ↗
(data: unknown)

Source from the content-addressed store, hash-verified

12// Bun's test runner doesn't have CompressionStream (browser API).
13// Use Bun's native zlib for the same deflate-raw + base64url pipeline.
14function compress(data: unknown): string {
15 const json = JSON.stringify(data);
16 const compressed = deflateSync(new TextEncoder().encode(json));
17 let binary = "";
18 for (let i = 0; i < compressed.length; i++) {
19 binary += String.fromCharCode(compressed[i]);
20 }
21 return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
22}
23
24function decompress(b64: string): unknown {
25 const base64 = b64.replace(/-/g, "+").replace(/_/g, "/");

Callers 1

crypto.test.tsFile · 0.70

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected