index.js
function checkPlatformSupported(version, platform) {
  const url = `${base}/${version}`;

  if (platform === 'darwin') {
    platform = 'osx64';
  }

  return new Promise((resolve, reject) => {
    https.get(url, (res) => {
      let body = '';

      res.on('error', reject);
      res.on('data', (d) => body += d.toString());
      res.on('end', () => {
        if (res.statusCode !== 200) {
          return reject(new Error(body));
        }

        let $ = cheerio.load(body);
        let links = [];

        $('a[href]').each((i, link) => links.push(link.attribs.href));

        for (let link of links) {
          if (link.includes(platform)) {
            return resolve(true);
          }
        }

        resolve(false);
      });
    }).on('error', reject);
  });
}
function checkPlatformSupported(version, platform) {
  const url = `${base}/${version}`;

  if (platform === 'darwin') {
    platform = 'osx64';
  }

  return new Promise((resolve, reject) => {
    https.get(url, (res) => {
      let body = '';

      res.on('error', reject);
      res.on('data', (d) => body += d.toString());
      res.on('end', () => {
        if (res.statusCode !== 200) {
          return reject(new Error(body));
        }

        let $ = cheerio.load(body);
        let links = [];

        $('a[href]').each((i, link) => links.push(link.attribs.href));

        for (let link of links) {
          if (link.includes(platform)) {
            return resolve(true);
          }
        }

        resolve(false);
      });
    }).on('error', reject);
  });
}
function checkPlatformSupported ( version , platform ) { const url = ` ${ base } ${ version } ` ; if ( platform === 'darwin' ) { platform = 'osx64' ; } return new Promise ( ( resolve , reject ) => { https . get ( url , ( res ) => { let body = '' ; res . on ( 'error' , reject ) ; res . on ( 'data' , ( d ) => body += d . toString ( ) ) ; res . on ( 'end' , ( ) => { if ( res . statusCode !== 200 ) { return reject ( new Error ( body ) ) ; } let $ = cheerio . load ( body ) ; let links = [ ] ; $ ( 'a[href]' ) . each ( ( i , link ) => links . push ( link . attribs . href ) ) ; for ( let link of links ) { if ( link . includes ( platform ) ) { return resolve ( true ) ; } } resolve ( false ) ; } ) ; } ) . on ( 'error' , reject ) ; } ) ; }
Scrapes the dist page by the given tor version and returns if the platform
is supported by the release
@param {string} version
@param {string} platform
Scrapes the dist page by the given tor version and returns if the platform is supported by the release