Promise version of fs.writefile
npm install fs-writefile-promise[![License][license-image]][license-url] [![version][npm-image]][npm-url] [![Build Status][circle-image]][circle-url]
> [Promise][] version of [fs.writeFile][]:
> Asynchronously writes data to a file, replacing the file if it already exists.
``bash`
npm install fs-writefile-promise
- _filename_: StringString
- _data_ or BufferObject
- _options_:
Return: Object ([Promise][])
When it finishes, it will be _fulfilled_ with the file name that was written to.
When it fails, it will be _rejected_ with an error as its first argument.
`js``
write('/tmp/foo', 'bar')
.then(filename => console.log(filename)) //=> '/tmp/foo'
.catch(err => console.error(err))
#### options
The option object will be directly passed to [fs.writeFile][].
---
> Author: Ahmad Nassri •
> Github: @ahmadnassri •
> Twitter: @AhmadNassri
[license-url]: LICENSE
[license-image]: https://img.shields.io/github/license/ahmadnassri/node-fs-writefile-promise.svg?style=for-the-badge&logo=circleci
[circle-url]: https://circleci.com/gh/ahmadnassri/workflows/node-fs-writefile-promise
[circle-image]: https://img.shields.io/circleci/project/github/ahmadnassri/node-fs-writefile-promise/master.svg?style=for-the-badge&logo=circleci
[npm-url]: https://www.npmjs.com/package/fs-writefile-promise
[npm-image]: https://img.shields.io/npm/v/fs-writefile-promise.svg?style=for-the-badge&logo=npm
[fs.writefile]: https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback
[promise]: http://promisesaplus.com/