scan.js
function checkFile(peripheralId, callback) {
  if (overWriteServices) {
    callback(false);
  } else {
    fs.stat(devicesPath + '/' + peripheralId + '.srv.json', function(err, stat) {
      if(err == null) {
        callback(true);
        //  console.log('File exists');
      } else {
        callback(false)
      }
    });   
  }
}
function checkFile(peripheralId, callback) {
  if (overWriteServices) {
    callback(false);
  } else {
    fs.stat(devicesPath + '/' + peripheralId + '.srv.json', function(err, stat) {
      if(err == null) {
        callback(true);
        //  console.log('File exists');
      } else {
        callback(false)
      }
    });   
  }
}
function checkFile ( peripheralId , callback ) { if ( overWriteServices ) { callback ( false ) ; } else { fs . stat ( devicesPath + '/' + peripheralId + '.srv.json' , function ( err , stat ) { if ( err == null ) { callback ( true ) ; //  console.log('File exists'); } else { callback ( false ) } } ) ; } }
check if the services file exists
check if the services file exists