Skip to content

gunzipSync failing (0 gzip length) on some npm package tarballs #207

@andrewbranch

Description

@andrewbranch

I’ve found three npm packages that fail to gunzip with fflate (the resulting length is 0), but work with Node.js’s zlib. Here’s a full repro:

// index.mjs
import { gunzipSync as zlibGunzipSync } from "zlib";
import { gunzipSync } from "fflate";

const brokenPackages = [
  "https://registry.npmjs.org/openurl/-/openurl-1.0.2.tgz",
  "https://registry.npmjs.org/is/-/is-0.0.7.tgz",
  "https://registry.npmjs.org/youtube/-/youtube-0.0.5.tgz",
];

for (const url of brokenPackages) {
  const tarballData = new Uint8Array(
    await fetch(url).then((r) => r.arrayBuffer())
  );

  console.log("fflate", gunzipSync(tarballData).length);
  console.log("zlib", zlibGunzipSync(tarballData).length);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions