Skip to content

Instantly share code, notes, and snippets.

@Shibly
Last active December 23, 2015 22:59
Show Gist options
  • Save Shibly/6707214 to your computer and use it in GitHub Desktop.
Save Shibly/6707214 to your computer and use it in GitHub Desktop.
A simple node.js script to fetch all your github repositories and their description.
var https = require('https');
var username = 'Shibly';
var options = {
host: 'api.github.com',
path: '/users/' + username + '/repos',
method: 'GET'
};
var request = https.request(options, function (response) {
var list_repos = '';
response.on("data", function (chunk) {
list_repos += chunk.toString('utf8');
});
response.on("end", function () {
var repos = [];
var repo_data = JSON.parse(list_repos);
repo_data.forEach(function (repo) {
repos.push({
name: repo.name,
description: repo.description
});
});
console.log("Repositories: ", repos);
});
});
request.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment