🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

cacache

Package Overview
Dependencies
Maintainers
4
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacache - npm Package Compare versions

Comparing version
21.0.0
to
21.0.1
+29
lib/util/cache-dir.js
'use strict'
const fs = require('fs/promises')
const path = require('path')
const tagContent = `Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cacache.
# For information about cache directory tags, see https://bford.info/cachedir/
`
async function mkdir (cache) {
await fs.mkdir(cache, { recursive: true, owner: 'inherit' })
await writeTag(cache)
}
async function writeTag (cache) {
try {
await fs.writeFile(path.join(cache, 'CACHEDIR.TAG'), tagContent, { flag: 'wx' })
} catch (err) {
if (err.code !== 'EEXIST') {
throw err
}
}
}
module.exports = {
mkdir,
tagContent,
}
+2
-0

@@ -13,2 +13,3 @@ 'use strict'

const ssri = require('ssri')
const cacheDir = require('../util/cache-dir')
const { tmpName } = require('../util/tmp')

@@ -157,2 +158,3 @@ const fsm = require('fs-minipass')

const tmpTarget = tmpName(cache, opts.tmpPrefix)
await cacheDir.mkdir(cache)
await fs.mkdir(path.dirname(tmpTarget), { recursive: true })

@@ -159,0 +161,0 @@ return {

@@ -16,2 +16,3 @@ 'use strict'

const { tmpName } = require('./util/tmp')
const cacheDir = require('./util/cache-dir')

@@ -74,2 +75,3 @@ const contentPath = require('./content/path')

const target = tmpName(cache, opts.tmpPrefix)
await cacheDir.mkdir(cache)
await mkdir(path.dirname(target), { recursive: true })

@@ -126,2 +128,3 @@ return {

try {
await cacheDir.mkdir(cache)
await mkdir(path.dirname(bucket), { recursive: true })

@@ -128,0 +131,0 @@ const stringified = JSON.stringify(entry)

@@ -30,3 +30,4 @@ 'use strict'

const paths = await glob(path.join(cache, '*(content-*|index-*)'), { silent: true, nosort: true })
paths.push(path.join(cache, 'CACHEDIR.TAG'))
return Promise.all(paths.map((p) => rm(p, { recursive: true, force: true })))
}

@@ -7,2 +7,3 @@ 'use strict'

const path = require('path')
const cacheDir = require('./cache-dir')

@@ -19,2 +20,3 @@ module.exports.mkdir = mktmpdir

const tmpDir = path.join(cache, 'tmp')
await cacheDir.mkdir(cache)
await fs.mkdir(tmpDir, { recursive: true, owner: 'inherit' })

@@ -33,3 +35,5 @@ // do not use path.join(), it drops the trailing / if tmpPrefix is unset

}
return withTempDir(path.join(cache, 'tmp'), cb, opts)
return cacheDir.mkdir(cache).then(() =>
withTempDir(path.join(cache, 'tmp'), cb, opts)
)
}
+2
-2
'use strict'
const {
mkdir,
readFile,

@@ -15,2 +14,3 @@ rm,

const index = require('./entry-index')
const cacheDir = require('./util/cache-dir')
const path = require('path')

@@ -81,3 +81,3 @@ const ssri = require('ssri')

opts.log.silly('verify', 'fixing cache permissions')
await mkdir(cache, { recursive: true })
await cacheDir.mkdir(cache)
return null

@@ -84,0 +84,0 @@ }

{
"name": "cacache",
"version": "21.0.0",
"version": "21.0.1",
"cache-version": {

@@ -61,3 +61,3 @@ "content": "2",

"devDependencies": {
"@npmcli/eslint-config": "^6.0.1",
"@npmcli/eslint-config": "^7.0.0",
"@npmcli/template-oss": "5.1.0",

@@ -64,0 +64,0 @@ "tap": "^16.0.0"