parcoursup/node_modules/@npmcli/fs/lib/write-file.js
lalBi94 7bc56c09b5 $
2023-03-05 13:23:23 +01:00

15 lines
395 B
JavaScript

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