cacache
Advanced tools
Comparing version 18.0.1 to 18.0.2
@@ -16,8 +16,5 @@ 'use strict' | ||
// get size | ||
const stat = await fs.stat(cpath) | ||
const stat = size ? { size } : await fs.stat(cpath) | ||
return { stat, cpath, sri } | ||
}) | ||
if (typeof size === 'number' && stat.size !== size) { | ||
throw sizeError(size, stat.size) | ||
} | ||
@@ -29,2 +26,7 @@ if (stat.size > MAX_SINGLE_READ_SIZE) { | ||
const data = await fs.readFile(cpath, { encoding: null }) | ||
if (stat.size !== data.length) { | ||
throw sizeError(stat.size, data.length) | ||
} | ||
if (!ssri.checkData(data, sri)) { | ||
@@ -60,9 +62,6 @@ throw integrityError(sri, cpath) | ||
const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => { | ||
// just stat to ensure it exists | ||
const stat = await fs.stat(cpath) | ||
// get size | ||
const stat = size ? { size } : await fs.stat(cpath) | ||
return { stat, cpath, sri } | ||
}) | ||
if (typeof size === 'number' && size !== stat.size) { | ||
return stream.emit('error', sizeError(size, stat.size)) | ||
} | ||
@@ -69,0 +68,0 @@ return readPipeline(cpath, stat.size, sri, stream) |
{ | ||
"name": "cacache", | ||
"version": "18.0.1", | ||
"version": "18.0.2", | ||
"cache-version": { | ||
@@ -19,3 +19,3 @@ "content": "2", | ||
"test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test", | ||
"lint": "eslint \"**/*.js\"", | ||
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", | ||
"npmclilint": "npmcli-lint", | ||
@@ -64,3 +64,3 @@ "lintfix": "npm run lint -- --fix", | ||
"@npmcli/eslint-config": "^4.0.0", | ||
"@npmcli/template-oss": "4.19.0", | ||
"@npmcli/template-oss": "4.21.3", | ||
"tap": "^16.0.0" | ||
@@ -74,3 +74,3 @@ }, | ||
"windowsCI": false, | ||
"version": "4.19.0", | ||
"version": "4.21.3", | ||
"publish": "true" | ||
@@ -77,0 +77,0 @@ }, |
63559
1243
9