Skip to content

Commit fb0561b

Browse files
committed
Updated documentation
1 parent 989c0aa commit fb0561b

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

lib/blob.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ var git = require('../'),
44
/**
55
* Blob convenience class constructor.
66
*
7-
* @param {git.raw.Repo} rawRepo
8-
* @param {git.raw.Blob|null} rawBlob
7+
* @constructor
8+
* @param {git.raw.Repo} rawRepo Raw repository object.
9+
* @param {git.raw.Blob} [rawBlob = new git.raw.Blob(rawRepo)] Raw blob object.
910
*/
1011
var Blob = function(rawRepo, rawBlob) {
1112
if(!(rawRepo instanceof git.raw.Repo)) {
@@ -24,10 +25,15 @@ var Blob = function(rawRepo, rawBlob) {
2425
/**
2526
* Retrieve the blob represented by the oid.
2627
*
27-
* @param {git.raw.Oid} oid
28-
* @param {Function} callback
28+
* @param {git.raw.Oid} oid The OID representing the blob to lookup.
29+
* @param {Blob~lookupCallback} callback
2930
*/
3031
Blob.prototype.lookup = function(oid, callback) {
32+
/**
33+
* @callback Blob~lookupCallback Callback executed on lookup completion.
34+
* @param {GitError|null} error An Error or null if successful.
35+
* @param {Blob|null} blob The populated blob object or null.
36+
*/
3137
var self = this;
3238
self.rawBlob.lookup(self.rawRepo, oid, function blobLookup(error, rawBlob) {
3339
if (success(error, callback)) {
@@ -40,9 +46,14 @@ Blob.prototype.lookup = function(oid, callback) {
4046
/**
4147
* Retrieve the blob's raw content buffer.
4248
*
43-
* @param {Function} callback
49+
* @param {Blob~rawContentCallback} callback
4450
*/
4551
Blob.prototype.rawContent = function(callback) {
52+
/**
53+
* @callback Blob~rawContentCallback Callback executed after raw content is retrieved.
54+
* @param {GitError|null} error An Error or null if successful.
55+
* @param {Buffer|null} content The raw content of the blob or null.
56+
*/
4657
this.rawBlob.rawContent(function(error, content) {
4758
if (success(error, callback)) {
4859
callback(null, content);
@@ -53,9 +64,14 @@ Blob.prototype.rawContent = function(callback) {
5364
/**
5465
* Retrieve the blob's content.
5566
*
56-
* @param {Function} callback
67+
* @param {Blob~contentCallback} callback
5768
*/
5869
Blob.prototype.content = function(callback) {
70+
/**
71+
* @callback Blob~contentCallback Callback executed after content is retrieved.
72+
* @param {GitError|null} error An Error or null if successful.
73+
* @param {String|null} content The content of the blob or null.
74+
*/
5975
this.rawContent(function(error, content) {
6076
if (success(error, callback)) {
6177
callback(null, content.toString());

0 commit comments

Comments
 (0)