var git = require('../'),
    path = require('path');

// This example opens a certain file, `README.md`, at a particular commit,
// and prints the first 10 lines as well as some metadata.

git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
  if (error) throw error;

  repo.getCommit('59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5', function(error, commit) {
    if (error) throw error;

    commit.getEntry('README.md', function(error, entry) {
      if (error) throw error;

      entry.getBlob(function(error, blob) {
        if (error) throw error;

        console.log(entry.name(), entry.sha(), blob.size() + 'b');
        console.log('========================================================\n\n');
        var firstTenLines = blob.toString().split('\n').slice(0, 10).join('\n');
        console.log(firstTenLines);
        console.log('...');
      });
    });
  });
});

@@ -1,12 +1,16 @@
 var 
+node
 git = re
@@ -23,16 +23,16 @@
 '../'),%0A
-
     path
@@ -190,17 +190,32 @@
 ta.%0A
-%0A
+var _entry;%0Anode
 git.Repo
 .ope
@@ -210,16 +210,22 @@
 git.Repo
+sitory
 .open(pa
@@ -256,18 +256,23 @@
 ./.git')
-, 
+).then(
 function
@@ -272,23 +272,16 @@
 unction(
-error, 
 repo) %7B%0A
@@ -286,34 +286,14 @@
 %7B%0A  
-if (error) throw error;%0A%0A 
+return
  rep
@@ -346,18 +346,27 @@
 f095ab5'
-, 
+);%0A%7D).then(
 function
@@ -366,23 +366,16 @@
 unction(
-error, 
 commit) 
@@ -382,38 +382,14 @@
 %7B%0A  
-  if (error) throw error;%0A%0A   
+return
  com
@@ -412,18 +412,27 @@
 ADME.md'
-, 
+);%0A%7D).then(
 function
@@ -432,23 +432,16 @@
 unction(
-error, 
 entry) %7B
@@ -447,43 +447,34 @@
 %7B%0A  
-    if (error) throw error
+_entry = entry
 ;%0A
-%0A
   
-    
+return _
 entr
@@ -483,16 +483,27 @@
 getBlob(
+);%0A%7D).then(
 function
@@ -507,23 +507,16 @@
 ion(
-error, 
 blob) %7B%0A
     
@@ -515,47 +515,8 @@
 ) %7B%0A
-        if (error) throw error;%0A%0A      
   co
@@ -529,22 +529,27 @@
 log(
+_
 entry.
+file
 name(), 
 entr
@@ -544,16 +544,17 @@
 name(), 
+_
 entry.sh
@@ -563,16 +563,19 @@
 ), blob.
+raw
 size() +
@@ -577,30 +577,24 @@
 e() + 'b');%0A
-      
   console.lo
@@ -660,22 +660,16 @@
 %5Cn%5Cn');%0A
-      
   var fi
@@ -735,22 +735,16 @@
 ('%5Cn');%0A
-      
   consol
@@ -765,22 +765,16 @@
 Lines);%0A
-      
   consol
@@ -791,32 +791,15 @@
 ');%0A
-      %7D);%0A    %7D);%0A  %7D);%0A%7D
+%7D).done(
 );%0A

update read-file example to use promises