index.js
function writeFile(filename, data) {
    return new Promise(function (fulfill, reject) {
        fs.writeFile(filename, data, function (err, res) {
            return err ? reject(err) : fulfill(res);
        });
    });
}
function writeFile(filename, data) {
    return new Promise(function (fulfill, reject) {
        fs.writeFile(filename, data, function (err, res) {
            return err ? reject(err) : fulfill(res);
        });
    });
}
function writeFile ( filename , data ) { return new Promise ( function ( fulfill , reject ) { fs . writeFile ( filename , data , function ( err , res ) { return err ? reject ( err ) : fulfill ( res ) ; } ) ; } ) ; }
Write the string data to file.
Asynchronous mode
@param {string} filename
@param {string} data
@returns {promise}
Write the string data to file . Asynchronous mode