PHP 8.2.30
Preview: path.js Size: 737 B
//opt/alt/alt-nodejs18/root/usr/lib/node_modules/npm/node_modules/cacache/lib/content/path.js

'use strict'

const contentVer = require('../../package.json')['cache-version'].content
const hashToSegments = require('../util/hash-to-segments')
const path = require('path')
const ssri = require('ssri')

// Current format of content file path:
//
// sha512-BaSE64Hex= ->
// ~/.my-cache/content-v2/sha512/ba/da/55deadbeefc0ffee
//
module.exports = contentPath

function contentPath (cache, integrity) {
  const sri = ssri.parse(integrity, { single: true })
  // contentPath is the *strongest* algo given
  return path.join(
    contentDir(cache),
    sri.algorithm,
    ...hashToSegments(sri.hexDigest())
  )
}

module.exports.contentDir = contentDir

function contentDir (cache) {
  return path.join(cache, `content-v${contentVer}`)
}

Directory Contents

Dirs: 0 × Files: 4

Name Size Perms Modified Actions
737 B lrw-r--r-- 2026-03-09 09:08:36
Edit Download
4.18 KB lrw-r--r-- 2026-03-09 09:08:36
Edit Download
481 B lrw-r--r-- 2026-03-09 09:08:36
Edit Download
5.61 KB lrw-r--r-- 2026-03-09 09:08:36
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).