文件操作 - retire-path.js
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/retire-path.js
编辑文件内容
const crypto = require('node:crypto') const { dirname, basename, resolve } = require('node:path') // use sha1 because it's faster, and collisions extremely unlikely anyway const pathSafeHash = s => crypto.createHash('sha1') .update(s) .digest('base64') .replace(/[^a-zA-Z0-9]+/g, '') .slice(0, 8) const retirePath = from => { const d = dirname(from) const b = basename(from) const hash = pathSafeHash(from) return resolve(d, `.${b}-${hash}`) } module.exports = retirePath
修改文件时间
将文件时间修改为当前时间的前一年
删除文件