Skip to content

Instantly share code, notes, and snippets.

@ben-bradley
Created April 20, 2015 15:26
Show Gist options
  • Save ben-bradley/3bf89e0d9d557feed311 to your computer and use it in GitHub Desktop.
Save ben-bradley/3bf89e0d9d557feed311 to your computer and use it in GitHub Desktop.
A small script to grab all the PCT maps from pctmap.net
var request = require('request'),
fs = require('fs'),
fnlimit = require('fnlimit');
//http://www.pctmap.net/pctdownloads/ca_section_a_map.zip
var files = [
'ca_section_a',
'ca_section_b',
'ca_section_c',
'ca_section_d',
'ca_section_e',
'ca_section_f',
'ca_section_g',
'ca_section_h',
'ca_section_i',
'ca_section_k',
'ca_section_l',
'ca_section_m',
'ca_section_n',
'ca_section_o',
'ca_section_p',
'ca_section_q',
'ca_section_r',
'or_section_b',
'or_section_c',
'or_section_d',
'or_section_e',
'or_section_f',
'or_section_g',
'wa_section_h',
'wa_section_i',
'wa_section_j',
'wa_section_k',
'wa_section_l'
];
fnlimit({
limit: 5,
list: files,
progress: true,
callback: function (file, next) {
var stream = request('http://www.pctmap.net/pctdownloads/' + file + '_map.zip');
stream.pipe(fs.createWriteStream(__dirname + '/maps/' + file + '_map.zip'));
stream.on('end', function () {
next();
});
stream.on('error', function (err) {
console.log(err);
next(err);
});
},
done: function (err) {
console.log('DONE!');
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment