index.js
function appendToFile(fileContent, filePath) {
  return new Promise((resolve, reject) => {
    fs.appendFile(filePath, fileContent, 'utf8', (err) => {
      if (err) {
        reject(err);
      } else {
        resolve(filePath);
      }
    });
  });
}
function appendToFile(fileContent, filePath) {
  return new Promise((resolve, reject) => {
    fs.appendFile(filePath, fileContent, 'utf8', (err) => {
      if (err) {
        reject(err);
      } else {
        resolve(filePath);
      }
    });
  });
}
function appendToFile ( fileContent , filePath ) { return new Promise ( ( resolve , reject ) => { fs . appendFile ( filePath , fileContent , 'utf8' , ( err ) => { if ( err ) { reject ( err ) ; } else { resolve ( filePath ) ; } } ) ; } ) ; }
Append a string to a file, if the file doesn't exist it is created
@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
Append a string to a file if the file doesn t exist it is created