Socket
Socket
Sign inDemoInstall

octonode

Package Overview
Dependencies
1
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

2

lib/octonode/client.js

@@ -74,3 +74,3 @@ (function() {

}
return callback(null, res.statusCode, body);
return callback(null, res.statusCode, body, res.headers);
};

@@ -77,0 +77,0 @@

@@ -99,2 +99,47 @@ (function() {

Repo.prototype.readme = function(cbOrRef, cb) {
if (!(cb != null) && cbOrRef) {
cb = cbOrRef;
cbOrRef = 'master';
}
return this.client.get("/repos/" + this.name + "/readme?ref=" + cbOrRef, function(err, s, b) {
if (err) return cb(err);
if (s !== 200) {
return cb(new Error("Repo readme error"));
} else {
return cb(null, b);
}
});
};
Repo.prototype.contents = function(path, cbOrRef, cb) {
if (!(cb != null) && cbOrRef) {
cb = cbOrRef;
cbOrRef = 'master';
}
return this.client.get("/repos/" + this.name + "/contents/" + path + "?ref=" + cbOrRef, function(err, s, b) {
if (err) return cb(err);
if (s !== 200) {
return cb(new Error("Repo contents error"));
} else {
return cb(null, b);
}
});
};
Repo.prototype.archive = function(format, cbOrRef, cb) {
if (!(cb != null) && cbOrRef) {
cb = cbOrRef;
cbOrRef = 'master';
}
return this.client.get("/repos/" + this.name + "/" + format + "/" + cbOrRef, function(err, s, b, h) {
if (err) return cb(err);
if (s !== 302) {
return cb(new Error("Repo archive error"));
} else {
return cb(null, h['Location']);
}
});
};
Repo.prototype.forks = function(cb) {

@@ -101,0 +146,0 @@ return this.client.get("/repos/" + this.name + "/forks", function(err, s, b) {

{
"name": "octonode",
"version": "0.2.1",
"version": "0.2.2",
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)",

@@ -5,0 +5,0 @@ "description": "nodejs wrapper for github v3 api",

@@ -320,2 +320,23 @@ # octonode

### Get the README for a repository (GET /repos/pksunkara/hub/readme)
```js
ghrepo.readme(callback); //file
ghrepo.readme('v0.1.0', callback); //file
```
### Get the contents of a path in repository
```js
ghrepo.contents('lib/index.js', callback); //path
ghrepo.contents('lib/index.js', 'v0.1.0', callback); //path
```
### Get archive link for a repository
```js
ghrepo.archive('tarball', callback); //link to archive
ghrepo.archive('zipball', 'v0.1.0', callback); //link to archive
```
### Get the blob for a repository (GET /repos/pksunkara/hub/git/blobs/SHA)

@@ -322,0 +343,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc