function folderFileMatcher2(Seed,ComPath,HashId){
      FolderFileMatcher(Seed,ComPath,HashId)
      .then((fileList)=>{
        fileList.forEach((fileObj)=>{
          var percentage = fileObj.percentage;
          var percentage = new Number(percentage);
          //Find Max simalar file
          if(!simalarRank.name){
            simalarRank.name = fileObj.fileName;
            simalarRank.percentage = percentage.valueOf();
          }
          else if(percentage.valueOf()>simalarRank.percentage){
            simalarRank.name = fileObj.fileName;
            simalarRank.percentage = percentage.valueOf();
          }

          console.log("File Name :"+fileObj.fileName);
          console.log("Percentage :"+fileObj.percentage+"%");

        });
        fs.readFile(ComapareDirPath+"/"+simalarRank.name,function(err,data){
          if(err) res.send('download read file fail!');
          mostSimFileHash = md5(data);
          simfileData = geth.getFileWithHash(mostSimFileHash);
          res.render('download',{fileName:fileData[0],
                                 address:fileData[1],
                                 hashId:req.params.hashId.toLowerCase(),
                                 timestamp:fileData[2]['c'][0],
                                 simFile : simfileData,
                                 mostSimFileHash : mostSimFileHash,
                                 percentage : simalarRank.percentage,
                                 status:"FIND"});
          //console.log(simfileData);
        });
        console.log("per :"+simalarRank.percentage);
        console.log("Rank :"+simalarRank.name);


      })
      .catch(
        (err)=>{console.log(err);}
      )
    }
//Compare all file in Folder with seed file
Compare all file in Folder with seed file
Compare all file in Folder with seed file
function folderFileMatcher2(Seed,ComPath,HashId){
      FolderFileMatcher(Seed,ComPath,HashId)
      .then((fileList)=>{
        fileList.forEach((fileObj)=>{
          var percentage = fileObj.percentage;
          var percentage = new Number(percentage);
          if(!simalarRank.name){
            simalarRank.name = fileObj.fileName;
            simalarRank.percentage = percentage.valueOf();
          }
          else if(percentage.valueOf()>simalarRank.percentage){
            simalarRank.name = fileObj.fileName;
            simalarRank.percentage = percentage.valueOf();
          }
          console.log("File Name :"+fileObj.fileName);
          console.log("Percentage :"+fileObj.percentage+"%");
        });
        fs.readFile(ComapareDirPath+"/"+simalarRank.name,function(err,data){
          if(err) res.send('download read file fail!');
          mostSimFileHash = md5(data);
          simfileData = geth.getFileWithHash(mostSimFileHash);
          res.render('download',{fileName:fileData[0],
                                 address:fileData[1],
                                 hashId:req.params.hashId.toLowerCase(),
                                 timestamp:fileData[2]['c'][0],
                                 simFile : simfileData,
                                 mostSimFileHash : mostSimFileHash,
                                 percentage : simalarRank.percentage,
                                 status:"FIND"});
        });
        console.log("per :"+simalarRank.percentage);
        console.log("Rank :"+simalarRank.name);
      })
      .catch(
        (err)=>{console.log(err);}
      )
    }
function folderFileMatcher2 ( Seed , ComPath , HashId ) { FolderFileMatcher ( Seed , ComPath , HashId ) . then ( ( fileList ) => { fileList . forEach ( ( fileObj ) => { var percentage = fileObj . percentage ; var percentage = new Number ( percentage ) ; if ( ! simalarRank . name ) { simalarRank . name = fileObj . fileName ; simalarRank . percentage = percentage . valueOf ( ) ; } else if ( percentage . valueOf ( ) > simalarRank . percentage ) { simalarRank . name = fileObj . fileName ; simalarRank . percentage = percentage . valueOf ( ) ; } console . log ( "File Name :" + fileObj . fileName ) ; console . log ( "Percentage :" + fileObj . percentage + "%" ) ; } ) ; fs . readFile ( ComapareDirPath + "/" + simalarRank . name , function ( err , data ) { if ( err ) res . send ( 'download read file fail!' ) ; mostSimFileHash = md5 ( data ) ; simfileData = geth . getFileWithHash ( mostSimFileHash ) ; res . render ( 'download' , { fileName : fileData [ 0 ] , address : fileData [ 1 ] , hashId : req . params . hashId . toLowerCase ( ) , timestamp : fileData [ 2 ] [ 'c' ] [ 0 ] , simFile : simfileData , mostSimFileHash : mostSimFileHash , percentage : simalarRank . percentage , status : "FIND" } ) ; } ) ; console . log ( "per :" + simalarRank . percentage ) ; console . log ( "Rank :" + simalarRank . name ) ; } ) . catch ( ( err ) => { console . log ( err ) ; } ) }
Compare all file in Folder with seed file
Compare all file in Folder with seed file
//Find Max simalar file //console.log(simfileData);