ProvenPin Install

fflate zip compress and inflate roundtrip: working versions (tested 2026-10-15)

Zip and unzip multiple files in memory with fflate, covering gzip strings and zip sync helpers offline.

passed2 passed · 0 failed2026-10-15 16:00 UTC
Status
passed
Last passed
2026-10-15 16:00 UTC
Tests
2 / 2
Language
TypeScript
Runtime
node v22.23.3
pinned versions3
fflate@0.8.3@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false
npm test
test environment
node v22.23.3
linux 6.17.0-1022-azure
x64
runner: github-actions 38764699834

The code

Exactly the files that passed. Your agent can pull them with get_recipe("fflate-zip-roundtrip") (install), or see them on GitHub.

package.json
{
  "name": "fflate-zip-roundtrip",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node --import tsx --test test/*.test.ts"
  },
  "dependencies": {"fflate":"0.8.3"},
  "devDependencies": {"@types/node":"26.6.5","tsx":"4.23.15"}
}
src/archive.ts
import { zipSync, unzipSync, strToU8, strFromU8, gzipSync, gunzipSync } from "fflate";

export function zipFiles(files: Record<string, string>) {
  const input: Record<string, Uint8Array> = {};
  for (const [name, text] of Object.entries(files)) input[name] = strToU8(text);
  return zipSync(input, { level: 6 });
}

export function unzipFiles(data: Uint8Array) {
  const out = unzipSync(data);
  const files: Record<string, string> = {};
  for (const [name, bytes] of Object.entries(out)) files[name] = strFromU8(bytes);
  return files;
}

export function gzipText(text: string) {
  return gzipSync(strToU8(text));
}

export function gunzipText(data: Uint8Array) {
  return strFromU8(gunzipSync(data));
}
test/archive.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { zipFiles, unzipFiles, gzipText, gunzipText } from "../src/archive.ts";

test("zip roundtrip preserves files", () => {
  const zipped = zipFiles({
    "readme.txt": "hello",
    "data/a.json": "{\"ok\":true}",
  });
  assert.ok(zipped.length > 20);
  const files = unzipFiles(zipped);
  assert.equal(files["readme.txt"], "hello");
  assert.equal(files["data/a.json"], "{\"ok\":true}");
});

test("gzip roundtrip", () => {
  const gz = gzipText("compress me");
  assert.ok(gz.length > 0);
  assert.equal(gunzipText(gz), "compress me");
});

Connect to ProvenPin

Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.

terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp

Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.