mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-18 16:13:55 +00:00
* improve docs * Update docs/ensureSymlink-sync.md Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com> * Update docs/ensureSymlink.md Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com> * add Error type to docs Co-authored-by: Ryan Zimmerman <17342435+RyanZim@users.noreply.github.com>
717 B
717 B
outputFileSync(file, data[, options])
Almost the same as writeFileSync (i.e. it overwrites), except that if the parent directory does not exist, it's created. file must be a file path (a buffer or a file descriptor is not allowed).
file<String>data<String> | <Buffer> | <Uint8Array>options<Object> | <String>(the same asfs.writeFileSync()options)
Example:
const fs = require('fs-extra')
const file = '/tmp/this/path/does/not/exist/file.txt'
fs.outputFileSync(file, 'hello!')
const data = fs.readFileSync(file, 'utf8')
console.log(data) // => hello!