index.js
function write (database) {
  var deferred = q.defer();

  // Write database to file under database name
  fs.writeFile(globalConfig.db.location + database + '.db.json', JSON.stringify(databases[database]), function (err) {
    if(err) return deferred.reject(err);

    deferred.resolve();
  });

  return deferred.promise;
}
function write (database) {
  var deferred = q.defer();

  // Write database to file under database name
  fs.writeFile(globalConfig.db.location + database + '.db.json', JSON.stringify(databases[database]), function (err) {
    if(err) return deferred.reject(err);

    deferred.resolve();
  });

  return deferred.promise;
}
function write ( database ) { var deferred = q . defer ( ) ; // Write database to file under database name fs . writeFile ( globalConfig . db . location + database + '.db.json' , JSON . stringify ( databases [ database ] ) , function ( err ) { if ( err ) return deferred . reject ( err ) ; deferred . resolve ( ) ; } ) ; return deferred . promise ; }
Writes a database to file

@param  {string} database Database to write
@return {promise} Denotes success or failure of write
Writes a database to file