cacache 16.1.0 → 16.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/content/read.js +6 -6
- package/lib/content/write.js +2 -0
- package/lib/entry-index.js +1 -0
- package/lib/get.js +1 -0
- package/package.json +4 -4
package/lib/content/read.js
CHANGED
|
@@ -13,7 +13,7 @@ async function read (cache, integrity, opts = {}) {
|
|
|
13
13
|
const { size } = opts
|
|
14
14
|
const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => {
|
|
15
15
|
// get size
|
|
16
|
-
const stat = await fs.
|
|
16
|
+
const stat = await fs.stat(cpath)
|
|
17
17
|
return { stat, cpath, sri }
|
|
18
18
|
})
|
|
19
19
|
if (typeof size === 'number' && stat.size !== size) {
|
|
@@ -73,15 +73,15 @@ function readStream (cache, integrity, opts = {}) {
|
|
|
73
73
|
// Set all this up to run on the stream and then just return the stream
|
|
74
74
|
Promise.resolve().then(async () => {
|
|
75
75
|
const { stat, cpath, sri } = await withContentSri(cache, integrity, async (cpath, sri) => {
|
|
76
|
-
// just
|
|
77
|
-
const stat = await fs.
|
|
76
|
+
// just stat to ensure it exists
|
|
77
|
+
const stat = await fs.stat(cpath)
|
|
78
78
|
return { stat, cpath, sri }
|
|
79
79
|
})
|
|
80
80
|
if (typeof size === 'number' && size !== stat.size) {
|
|
81
81
|
return stream.emit('error', sizeError(size, stat.size))
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
readPipeline(cpath, stat.size, sri, stream)
|
|
84
|
+
return readPipeline(cpath, stat.size, sri, stream)
|
|
85
85
|
}).catch(err => stream.emit('error', err))
|
|
86
86
|
|
|
87
87
|
return stream
|
|
@@ -111,7 +111,7 @@ async function hasContent (cache, integrity) {
|
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
113
|
return await withContentSri(cache, integrity, async (cpath, sri) => {
|
|
114
|
-
const stat = await fs.
|
|
114
|
+
const stat = await fs.stat(cpath)
|
|
115
115
|
return { size: stat.size, sri, stat }
|
|
116
116
|
})
|
|
117
117
|
} catch (err) {
|
|
@@ -139,7 +139,7 @@ function hasContentSync (cache, integrity) {
|
|
|
139
139
|
|
|
140
140
|
return withContentSriSync(cache, integrity, (cpath, sri) => {
|
|
141
141
|
try {
|
|
142
|
-
const stat = fs.
|
|
142
|
+
const stat = fs.statSync(cpath)
|
|
143
143
|
return { size: stat.size, sri, stat }
|
|
144
144
|
} catch (err) {
|
|
145
145
|
if (err.code === 'ENOENT') {
|
package/lib/content/write.js
CHANGED
|
@@ -80,9 +80,11 @@ class CacacheWriteStream extends Flush {
|
|
|
80
80
|
// defer this one tick by rejecting a promise on it.
|
|
81
81
|
return Promise.reject(e).catch(cb)
|
|
82
82
|
}
|
|
83
|
+
// eslint-disable-next-line promise/catch-or-return
|
|
83
84
|
this.handleContentP.then(
|
|
84
85
|
(res) => {
|
|
85
86
|
res.integrity && this.emit('integrity', res.integrity)
|
|
87
|
+
// eslint-disable-next-line promise/always-return
|
|
86
88
|
res.size !== null && this.emit('size', res.size)
|
|
87
89
|
cb()
|
|
88
90
|
},
|
package/lib/entry-index.js
CHANGED
package/lib/get.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cacache",
|
|
3
|
-
"version": "16.1.
|
|
3
|
+
"version": "16.1.3",
|
|
4
4
|
"cache-version": {
|
|
5
5
|
"content": "2",
|
|
6
6
|
"index": "5"
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"rimraf": "^3.0.2",
|
|
66
66
|
"ssri": "^9.0.0",
|
|
67
67
|
"tar": "^6.1.11",
|
|
68
|
-
"unique-filename": "^
|
|
68
|
+
"unique-filename": "^2.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@npmcli/eslint-config": "^3.0.1",
|
|
72
|
-
"@npmcli/template-oss": "3.
|
|
72
|
+
"@npmcli/template-oss": "3.5.0",
|
|
73
73
|
"tap": "^16.0.0"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"templateOSS": {
|
|
79
79
|
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
80
80
|
"windowsCI": false,
|
|
81
|
-
"version": "3.
|
|
81
|
+
"version": "3.5.0"
|
|
82
82
|
},
|
|
83
83
|
"author": "GitHub Inc."
|
|
84
84
|
}
|