diff --git a/lib/node/asar-fs-wrapper.ts b/lib/node/asar-fs-wrapper.ts index 4e3602df4e..bf0d3e705d 100644 --- a/lib/node/asar-fs-wrapper.ts +++ b/lib/node/asar-fs-wrapper.ts @@ -135,10 +135,10 @@ const asarStatsToFsStats = function (stats: NodeJS.AsarFileStat) { uid, gid, 0, // rdev - undefined, // blksize + 4096, // blksize ++nextInode, // ino stats.size, - undefined, // blocks, + Math.ceil(stats.size / 512), // blocks (512-byte units) fakeTime.getTime(), // atim_msec fakeTime.getTime(), // mtim_msec fakeTime.getTime(), // ctim_msec diff --git a/spec/asar-spec.ts b/spec/asar-spec.ts index e8e4e1b05d..0243b38d05 100644 --- a/spec/asar-spec.ts +++ b/spec/asar-spec.ts @@ -458,6 +458,14 @@ describe('asar package', function () { expect(stats.size).to.equal(0); }); + itremote('returns stat properties with types matching a real file', function () { + const asarStats = fs.lstatSync(path.join(asarDir, 'a.asar', 'file1')); + const realStats = fs.lstatSync(path.join(fixtures, 'test.asar', 'a.asar')); + for (const key of Object.keys(realStats) as (keyof typeof realStats)[]) { + expect(typeof asarStats[key]).to.equal(typeof realStats[key], `typeof stats.${key}`); + } + }); + itremote('returns information of root with stats as bigint', function () { const p = path.join(asarDir, 'a.asar'); const stats = fs.lstatSync(p, { bigint: false });