npm install fs-writefile-promise
write(filename, data [, options])
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.
write('/tmp/foo', 'bar') .then(filename => console.log(filename)) //=> '/tmp/foo' .catch(err => console.error(err))
The option object will be directly passed to fs.writeFile.