A little JavaScript Help???
var fs = require('fs'), childProcess = require('child_process'), xml2js = require('xml2js'); var parser = new xml2js.Parser(); fs.readFile(__dirname + '/subscription_manager.xml', function (err, data) { parser.parseString(data, function (err, result) { var nodes = result.opml.body[0].outline[0].outline; nodes.forEach(function (node, index) { var url = node['$'].xmlUrl; url = url.substring(url.indexOf('=') + 1, url.length); var channel = 'https://www.youtube.com/channel/' + url; if (index === 1) { childProcess.exec('start chrome ' + channel); console.log(result, index, channel); } }); }); }); In this code, JavaScript is used to open a youtube channel link from the downloaded "subscription_manager.xml" file in a new Google Chrome tab. The if statement with "index === 1" is a safeguard (because I have 220 subscriptions) so that it only opens one tab. I am trying to get it to open at least 10 tabs but every time I adjust the statement it gets ignored no matter what amount I enter, so instead it tries to open all the links and uses all the RAM and crashes my PC. When I change "index<=1" to "index<=10" using for, do-while, and while loops, the terminal logs 10 copies of the all the links. So 2200 lines of URL's, when changed back to "index<=1" it logs one of each link. I only need it to open a portion of the file, but if I set the number to anything other than 1 it just glitches. Can somebody please show me how to fix this?