index.js
function writeToFile(fileContent, filePath) {
  return new Promise((resolve, reject) => {
    fs.writeFile(filePath, fileContent, 'utf8', (err) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(filePath);
    });
  });
}
function writeToFile(fileContent, filePath) {
  return new Promise((resolve, reject) => {
    fs.writeFile(filePath, fileContent, 'utf8', (err) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(filePath);
    });
  });
}
function writeToFile ( fileContent , filePath ) { return new Promise ( ( resolve , reject ) => { fs . writeFile ( filePath , fileContent , 'utf8' , ( err ) => { if ( err ) { reject ( err ) ; return ; } resolve ( filePath ) ; } ) ; } ) ; }
Write a string to a file
@param {string} fileContent the payload of the file
@param {string} filePath path and filename: where store the file
@returns {Promise<string>} resolve with the filePath received in input
Write a string to a file