hexo/node_modules/@npmcli/fs/lib/write-file.js

15 lines
395 B
JavaScript
Raw Normal View History

2023-09-25 15:58:56 +08:00
const fs = require('./fs.js')
const getOptions = require('./common/get-options.js')
const withOwner = require('./with-owner.js')
const writeFile = async (file, data, opts) => {
const options = getOptions(opts, {
copy: ['encoding', 'mode', 'flag', 'signal'],
wrap: 'encoding',
})
return withOwner(file, () => fs.writeFile(file, data, options), opts)
}
module.exports = writeFile