Created
January 19, 2015 19:42
-
-
Save ChetHarrison/28e424a52f7997e03585 to your computer and use it in GitHub Desktop.
read-repo.js
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
'use strict'; | |
var fs = require('fs'), | |
path = require('path'), | |
jsToAst = require('./src/parsers/js-to-ast.js'), | |
https = require('https'), | |
rawGitScrUrl = 'https://rawgit.com/marionettejs/backbone.marionette/master/src/', | |
get, srcFileList, options; | |
get = function(options) { | |
https.get(options, function (res) { | |
res.setEncoding('utf8'); | |
res.on('data', function (chunk) { | |
console.log(chunk); | |
// console.log(jsToAst.parse(chunk)); // <-- here is our file in a string | |
}); | |
}).on('error', function (e) { | |
console.log('Got error: ' + e.message); | |
}); | |
}; | |
options = { | |
hostname: 'api.github.com', | |
path: 'repos/marionettejs/backbone.marionette/contents/src/', | |
headers: { | |
'User-Agent': 'ChetHarrison' | |
} | |
}; | |
srcFileList = get(options); | |
console.log(srcFileList); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment