var config = require('./config')
<<<<<<< HEAD
var fs = require('fs');
var path = require('path');
var childProcess = require('child_process'),
    unrarProcess;

exports.initUnrar = function(folder){
  resultRar = undefined;
  resultR00 = undefined;
	console.log('Unrar folder: ' + folder);
	fs.readdir(folder, function(err,files){
		//console.log(files);
    var i = 0;
    (function next() {
      var file = files[i++];
      if (!file) { //if all files are checked
        if( resultRar === undefined & resultR00 === undefined ){ //nothing found to unrar
          console.log('Nothing to unrar');
        }else{ // check if rar or r00
          if(resultRar){
            unrar(folder,resultRar)
          }else{
            unrar(folder, resultR00)
          }
        }
        return;
      }
      
      if(path.extname(file) === '.rar'){
        resultRar = file;
        console.log('RAR ' + file);
      }
      if(path.extname(file) === '.r00'){
        resultRar = file;
        console.log('R00 ' + file);
      }
      next();   
    })();
	});
}

var unrar = function(folder,file){
  unrarProcess = childProcess.exec('unrar e ' + folder + '/' + file + ' ' + folder, function (error, stdout, stderr) {
   if (error) {
     console.log(error.stack);
     console.log('Error code: '+error.code);
     console.log('Signal received: '+error.signal);
   }
   console.log('Child Process STDOUT: '+stdout);
   console.log('Child Process STDERR: '+stderr);
 });

 unrarProcess.on('exit', function (code) {
   console.log('Child process exited with exit code ' + code);
 });
};
=======
var RarArchive = require('rarjs');
var fs = require('fs');

exports.initUnrar = function(folder){
	console.log('Unrar folder: ' + folder);
	fs.readdir(folder, function(err,files){
		console.log(files);
	});
}

var file = RarArchive({type: RarArchive.OPEN_LOCAL, file: '/mnt/Downloads/Blue.Bloods.S02E15.Phantom.GERMAN.DUBBED.DL.720p.WebHD.h264-euHD/euhd-blue-s02e15-720p.r00'}, function(err) {
  this.entries.forEach(function(val) {
    console.log(val.path);
  });
});
>>>>>>> aa7b05d41bde6da31e049e0836ed642fb0c7017e

@@ -31,21 +31,8 @@
 ')%0D%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
 var 
@@ -1626,545 +1626,4 @@
 %7D;%0D%0A
-=======%0Avar RarArchive = require('rarjs');%0D%0Avar fs = require('fs');%0D%0A%0D%0Aexports.initUnrar = function(folder)%7B%0D%0A%09console.log('Unrar folder: ' + folder);%0D%0A%09fs.readdir(folder, function(err,files)%7B%0D%0A%09%09console.log(files);%0D%0A%09%7D);%0D%0A%7D%0D%0A%0D%0Avar file = RarArchive(%7Btype: RarArchive.OPEN_LOCAL, file: '/mnt/Downloads/Blue.Bloods.S02E15.Phantom.GERMAN.DUBBED.DL.720p.WebHD.h264-euHD/euhd-blue-s02e15-720p.r00'%7D, function(err) %7B%0D%0A  this.entries.forEach(function(val) %7B%0D%0A    console.log(val.path);%0D%0A  %7D);%0D%0A%7D);%0A%3E%3E%3E%3E%3E%3E%3E aa7b05d41bde6da31e049e0836ed642fb0c7017e%0A

Update unrar.js