Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

perf(artifacts): reuse the admitted ASAR header size

morlutocb13a27bfa1f
diff --git a/src/artifacts/AsarArtifactReader.ts b/src/artifacts/AsarArtifactReader.ts
index 80e9fec0f..9b33d03ea 100644
--- a/src/artifacts/AsarArtifactReader.ts
+++ b/src/artifacts/AsarArtifactReader.ts
@@ -19,7 +19,7 @@ import { isAbsolute, join, relative, sep } from "node:path";
import { Readable, Transform } from "node:stream";
import { pipeline } from "node:stream/promises";
-import { getRawHeader, listPackage, statFile, uncache } from "@electron/asar";
+import { listPackage, statFile, uncache } from "@electron/asar";
import {
ArtifactReaderFailure,
@@ -65,6 +65,7 @@ export class AsarArtifactReader implements ArtifactReader {
try {
const admitted = await admitAsarHeader(headerHandle);
this.#archiveSize = admitted.archiveBytes;
+ this.#headerSize = admitted.headerBytes;
} finally {
await headerHandle.close();
}
@@ -72,7 +73,6 @@ export class AsarArtifactReader implements ArtifactReader {
paths = listPackage(snapshotPath, { isPack: false }).sort((left, right) =>
left.localeCompare(right, "en"),
);
- this.#headerSize = getRawHeader(snapshotPath).headerSize;
const archiveMetadata = await lstat(snapshotPath);
if (!archiveMetadata.isFile() || archiveMetadata.isSymbolicLink())
throw new ArtifactReaderFailure(