Skip to content

Commit 7e7872c

Browse files
committed
Added blob to library
1 parent ebedc29 commit 7e7872c

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

CONTRIBUTORS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ nodegit2 contributors (sorted alphabeticaly)
88

99
* JS API suggestions
1010

11+
* **[Rick Waldron](https://github.com/rwldrn)**
12+
13+
* JS API suggestions
14+
1115
* **[Tim Branyen](https://github.com/tbranyen)**
1216

1317
* Project creator

lib/blob.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var git = require( '../' );
2+
3+
var _Blob = function( obj ) {
4+
var self = {};
5+
6+
if( obj instanceof git.raw.Repo ) {
7+
self.repo = obj;
8+
self.blob = new git.raw.Blob( obj );
9+
}
10+
else if ( obj instanceof git.raw.Blob ) {
11+
self.blob = obj;
12+
}
13+
14+
self.content = function() {
15+
return self.blob.rawContent();
16+
};
17+
18+
return self;
19+
};
20+
21+
exports.blob = _Blob;

lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var util = require( './util.js' ).util,
2+
blob = require( './blob.js' ).blob,
23
repo = require( './repo.js' ).repo,
34
error = require( './error.js' ).error,
45
sig = require( './sig.js' ).sig,
@@ -9,6 +10,7 @@ var util = require( './util.js' ).util,
910
tree = require( './tree.js' ).tree;
1011

1112
exports.raw = require( '../build/default/nodegit' );
13+
exports.blob = blob;
1214
exports.util = util;
1315
exports.repo = repo;
1416
exports.ref = ref;

0 commit comments

Comments
 (0)