Skip to content

Commit 82b3e7e

Browse files
committed
Use fflate streaming API to work around 101arrowz/fflate#207
1 parent fbc894d commit 82b3e7e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/core/src/createPackage.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { untar } from "@andrewbranch/untar.js";
2-
import { gunzipSync } from "fflate";
2+
import { Gunzip } from "fflate";
33
import { major, maxSatisfying, minor, valid, validRange } from "semver";
44
import ts from "typescript";
55
import { parsePackageSpec, type ParsedPackageSpec } from "./utils.js";
@@ -279,7 +279,10 @@ export function createPackageFromTarballData(tarball: Uint8Array): Package {
279279
}
280280

281281
function extractTarball(tarball: Uint8Array) {
282-
const data = untar(gunzipSync(tarball));
282+
// Use streaming API to work around https://github.com/101arrowz/fflate/issues/207
283+
let unzipped: Uint8Array;
284+
new Gunzip((chunk) => (unzipped = chunk)).push(tarball, /*final*/ true);
285+
const data = untar(unzipped!);
283286
const prefix = data[0].filename.substring(0, data[0].filename.indexOf("/") + 1);
284287
const packageJsonText = data.find((f) => f.filename === `${prefix}package.json`)?.fileData;
285288
const packageJson = JSON.parse(new TextDecoder().decode(packageJsonText));
10 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"packageName": "openurl",
3+
"packageVersion": "1.0.2",
4+
"types": false
5+
}

0 commit comments

Comments
 (0)