Skip to content

Commit 5c9c83f

Browse files
author
Jessica Lord
committed
add Repository.delete
1 parent 5283017 commit 5c9c83f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

github.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,24 @@
544544
});
545545
});
546546
};
547-
547+
548+
// Delete a file from the tree
549+
// -------
550+
551+
this.delete = function(branch, path, cb) {
552+
that.getSha(branch, path, function(err, sha) {
553+
if (!sha) return cb("not found", null);
554+
var delPath = repoPath + "/contents/" + path;
555+
var params = {
556+
"message": "Deleted " + path,
557+
"sha": sha
558+
};
559+
delPath += "?message=" + encodeURIComponent(params.message);
560+
delPath += "&sha=" + encodeURIComponent(params.sha);
561+
_request("DELETE", delPath, null, cb);
562+
})
563+
}
564+
548565
// Move a file to a new location
549566
// -------
550567

0 commit comments

Comments
 (0)