Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
12345678910111213141516171819
  1. # outputFileSync(file, data, [options])
  2. Almost the same as `writeFileSync` (i.e. it [overwrites](http://pages.citebite.com/v2o5n8l2f5reb)), 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). `options` are what you'd pass to [`fs.writeFileSync()`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options).
  3. - `file` `<String>`
  4. - `data` `<String> | <Buffer> | <Uint8Array>`
  5. - `options` `<Object> | <String>`
  6. ## Example:
  7. ```js
  8. const fs = require('fs-extra')
  9. const file = '/tmp/this/path/does/not/exist/file.txt'
  10. fs.outputFileSync(file, 'hello!')
  11. const data = fs.readFileSync(file, 'utf8')
  12. console.log(data) // => hello!
  13. ```