Skip to content

Instantly share code, notes, and snippets.

@lawrencejones
Created December 24, 2013 03:48
Show Gist options
  • Save lawrencejones/8108571 to your computer and use it in GitHub Desktop.
Save lawrencejones/8108571 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var http = require('http');
var argv = process.argv.splice(2),
truecount = argv.length,
pages = [];
function printUrls() {
if (--truecount > 0)
return;
for (i = 0; i < pages.length; i++) {
console.log(pages[i].data + '\n\n');
}
}
function HTMLPage(url) {
var _page = this;
_page.data = '### [URL](' + url + ')\n';
http.get(url, function(res) {
res.setEncoding('utf8');
res.on('data', function(data) {
_page.data += data;
});
res.on('end', printUrls);
});
}
for (var i = 0; i < argv.length; i++)
pages.push(new HTMLPage(argv[i]));
@Ra1nWarden
Copy link

I see. Thank you!

@lawrencejones
Copy link
Author

If you could upvote my answer it would be much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment