lib/src/main.js
function saveFile(filename, data, overwrite) {
  if (overwrite) {
    return fs.outputFile(filename, data)
      .then(() => filename);
  } else {
    return new Promise((resolve, reject) => {
      fsu.writeFileUnique(
        filename.replace(fileExtRegex, '{_###}$&'),
        data,
        { force: true },
        (err, savedFile) => err === null ? resolve(savedFile) : reject(err)
      );
    });
  }
}
function saveFile(filename, data, overwrite) {
  if (overwrite) {
    return fs.outputFile(filename, data)
      .then(() => filename);
  } else {
    return new Promise((resolve, reject) => {
      fsu.writeFileUnique(
        filename.replace(fileExtRegex, '{_###}$&'),
        data,
        { force: true },
        (err, savedFile) => err === null ? resolve(savedFile) : reject(err)
      );
    });
  }
}
function saveFile ( filename , data , overwrite ) { if ( overwrite ) { return fs . outputFile ( filename , data ) . then ( ( ) => filename ) ; } else { return new Promise ( ( resolve , reject ) => { fsu . writeFileUnique ( filename . replace ( fileExtRegex , '{_###}$&' ) , data , { force : true } , ( err , savedFile ) => err === null ? resolve ( savedFile ) : reject ( err ) ) ; } ) ; } }
Saves a file

@param {string} filename Name of file to save
@param {string} data Data to be saved
@param {boolean} overwrite Overwrite existing files (default: true)

@return {Promise} Resolves with filename if successfully saved
Saves a file