Montag, 16. Juni 2014

Bitbucket: Search file size to find big files

To find big files in your repository you can press F12 and search in your browser using the Bitbucket Api. Here is an example:
function getFolder(name){
 $.getJSON(name, function(response)
 { 
  $.each(response.directories, function(i, a)
  { 
   getFolder(name + '/' + a);
  } );
  $.each(response.files, function(i,a){ 
   if (a.size > 1024*1024 ) console.log(name, a);
  });
 });
}

getFolder('https://bitbucket.org/api/1.0/repositories/<user>/<rep-slug>/src/master/');


Like it? Share it! Flattr this

Keine Kommentare: