source: node_modules/@npmcli/fs/lib/write-file.js@ 81bc7da

finki-main main
Last change on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 507 bytes
Line 
1const fs = require('./fs.js')
2const getOptions = require('./common/get-options.js')
3const owner = require('./common/owner.js')
4
5const writeFile = async (file, data, opts) => {
6 const options = getOptions(opts, {
7 copy: ['encoding', 'mode', 'flag', 'signal', 'owner'],
8 wrap: 'encoding',
9 })
10 const { uid, gid } = await owner.validate(file, options.owner)
11
12 const result = await fs.writeFile(file, data, options)
13
14 await owner.update(file, uid, gid)
15
16 return result
17}
18
19module.exports = writeFile
Note: See TracBrowser for help on using the repository browser.