code: function zip_dir_sync(dir, zipped_dir) {
  
      var entries = fs.readdirSync(dir);
      var entries_count = entries.length;
  
      for(var i = 0; i < entries_count; i++) {
          var entry = entries[i];
          var entry_normalized_path = path.normalize(dir + path.sep + entry);
          var entry_stats = fs.statSync(entry_normalized_path);
  
          if(entry_stats.isDirectory()) {
  
              var new_zipped_dir = zipped_dir.folder(entry);
  
              // recursively zip the newly found dir
              zip_dir_sync(entry_normalized_path, new_zipped_dir);
          }
          else {
  
              var file = fs.readFileSync(entry_normalized_path);
  
              // zip the file within current subdir
              zipped_dir.file(entry, file);
          }
      }
  }
docs: /*
  recursively and synchronously visits the directory and all subdirectories and zips all files it finds
  @param dir {String}: the path to the subdirectory
  @param zipped_dir {JSZip}: the JSZip object with the new directory as root