Welcome to mirror list, hosted at ThFree Co, Russian Federation.

write-file.js « lib « fs « @npmcli « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ff900571a1f28b368d8ecee0426bbd7191e4b89b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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