fs-writefile-promise
Promise version of fs.writefile:
Match files using the patterns the shell uses, like stars and stuff.
Install
npm install --save fs-writefile-promise
API
var write = require('fs-writefile-promise')
write(filename, data [, options])
filename: String
data String
or Buffer
options: Object
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.
write('/tmp/foo', 'bar')
.then(function (filename) {
console.log(filename)
})
.catch(function (err) {
console.error(err)
})
})
options
The option object will be directly passed to fs.writefile.
License
ISC License © Ahmad Nassri