$
This commit is contained in:
21
node_modules/@npmcli/fs/lib/with-owner.js
generated
vendored
Normal file
21
node_modules/@npmcli/fs/lib/with-owner.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
Reference in New Issue
Block a user