Last active
December 23, 2015 22:59
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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