Files
NapCatQQ/.pnpm-store/v3/files/fd/e5b17dcbd794dfe82c2a32d4f4258e39934491b746e5a6cfbef2b0e607ee6657f42028a3e4380f0eaa6f5e57d62e24bf683bc6b348bc40df54a15a1c55cecc
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

22 lines
495 B
Plaintext

const getOptions = require('./common/get-options.js')
const owner = require('./common/owner.js')
const withOwner = async (path, fn, opts) => {
const options = getOptions(opts, {
copy: ['owner'],
})
const { uid, gid } = await owner.validate(path, options.owner)
const result = await fn({ uid, gid })
await Promise.all([
owner.update(path, uid, gid),
typeof result === 'string' ? owner.update(result, uid, gid) : null,
])
return result
}
module.exports = withOwner