@pnpm/store.cafs
Advanced tools
Comparing version 2.0.12 to 2.0.13
@@ -26,24 +26,26 @@ "use strict"; | ||
} | ||
if (file.isFile()) { | ||
const relativePath = path_1.default.relative(rootDir, fullPath); | ||
let stat; | ||
try { | ||
stat = fs_1.default.statSync(fullPath); | ||
const relativePath = path_1.default.relative(rootDir, fullPath); | ||
let stat; | ||
try { | ||
stat = fs_1.default.statSync(fullPath); | ||
} | ||
catch (err) { // eslint-disable-line | ||
if (err.code !== 'ENOENT') { | ||
throw err; | ||
} | ||
catch (err) { // eslint-disable-line | ||
if (err.code !== 'ENOENT') { | ||
throw err; | ||
} | ||
continue; | ||
} | ||
const buffer = graceful_fs_1.default.readFileSync(fullPath); | ||
if (rootDir === currDir && readManifest && file.name === 'package.json') { | ||
manifest = (0, parseJson_1.parseJsonBufferSync)(buffer); | ||
} | ||
index[relativePath] = { | ||
mode: stat.mode, | ||
size: stat.size, | ||
...addBuffer(buffer, stat.mode), | ||
}; | ||
continue; | ||
} | ||
if (stat.isDirectory()) { | ||
_retrieveFileIntegrities(addBuffer, rootDir, fullPath, index); | ||
continue; | ||
} | ||
const buffer = graceful_fs_1.default.readFileSync(fullPath); | ||
if (rootDir === currDir && readManifest && file.name === 'package.json') { | ||
manifest = (0, parseJson_1.parseJsonBufferSync)(buffer); | ||
} | ||
index[relativePath] = { | ||
mode: stat.mode, | ||
size: stat.size, | ||
...addBuffer(buffer, stat.mode), | ||
}; | ||
} | ||
@@ -50,0 +52,0 @@ return manifest; |
@@ -18,3 +18,2 @@ "use strict"; | ||
const FILE_TYPE_LONGLINK = 'L'.charCodeAt(0); | ||
const USTAR_MAGIC = Buffer.from('ustar', 'latin1'); | ||
const MODE_OFFSET = 100; | ||
@@ -24,3 +23,2 @@ const FILE_SIZE_OFFSET = 124; | ||
const FILE_TYPE_OFFSET = 156; | ||
const MAGIC_OFFSET = 257; | ||
const PREFIX_OFFSET = 345; | ||
@@ -62,5 +60,2 @@ // See TAR specification here: https://www.gnu.org/software/tar/manual/html_node/Standard.html | ||
} | ||
if (buffer.compare(USTAR_MAGIC, 0, USTAR_MAGIC.byteLength, blockStart + MAGIC_OFFSET, blockStart + MAGIC_OFFSET + USTAR_MAGIC.byteLength) !== 0) { | ||
throw new Error(`This parser only supports USTAR or GNU TAR archives. Found magic and version: ${buffer.toString('latin1', blockStart + MAGIC_OFFSET, blockStart + MAGIC_OFFSET + 8)}`); | ||
} | ||
// Mark that the first path segment has not been removed. | ||
@@ -67,0 +62,0 @@ pathTrimmed = false; |
{ | ||
"name": "@pnpm/store.cafs", | ||
"version": "2.0.12", | ||
"version": "2.0.13", | ||
"description": "A content-addressable filesystem for the packages storage", | ||
@@ -26,5 +26,6 @@ "main": "lib/index.js", | ||
"@types/ssri": "^7.1.4", | ||
"symlink-dir": "^5.2.1", | ||
"tempy": "^1.0.1", | ||
"@pnpm/cafs-types": "4.0.0", | ||
"@pnpm/store.cafs": "2.0.12", | ||
"@pnpm/store.cafs": "2.0.13", | ||
"@pnpm/types": "9.4.2" | ||
@@ -31,0 +32,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59227
8
782