vendor/nexe/exe.js
function downloadNode(next) {
        if (fs.existsSync(nodeFilePath)) return next();

        var uri = framework;

        if (framework === 'node') {
          uri = 'nodejs'; // if node, use nodejs uri
        } else if (framework === 'nodejs') {
          framework = 'node'; // support nodejs, and node, as framework.
        }

        var type = global.type;
        var url,
          prefix = 'https://' + uri + '.org/dist';

        if (version === 'latest') {
          url = prefix + '/' + framework + '-' + version + '.tar.gz';
        } else {
          url =
            prefix +
            '/v' +
            version +
            '/' +
            framework +
            '-v' +
            version +
            '.tar.gz';
        }

        _log('downloading %s', url);

        var output = fs.createWriteStream(nodeFilePath, {
          flags: 'w+',
        });

        // need to set user-agent to bypass some corporate firewalls
        var requestOptions = {
          url: url,
          headers: {
            'User-Agent': 'Node.js',
          },
        };

        _logProgress(request(requestOptions)).pipe(output);

        output.on('close', function() {
          next();
        });
      }
function downloadNode(next) {
        if (fs.existsSync(nodeFilePath)) return next();

        var uri = framework;

        if (framework === 'node') {
          uri = 'nodejs'; // if node, use nodejs uri
        } else if (framework === 'nodejs') {
          framework = 'node'; // support nodejs, and node, as framework.
        }

        var type = global.type;
        var url,
          prefix = 'https://' + uri + '.org/dist';

        if (version === 'latest') {
          url = prefix + '/' + framework + '-' + version + '.tar.gz';
        } else {
          url =
            prefix +
            '/v' +
            version +
            '/' +
            framework +
            '-v' +
            version +
            '.tar.gz';
        }

        _log('downloading %s', url);

        var output = fs.createWriteStream(nodeFilePath, {
          flags: 'w+',
        });

        // need to set user-agent to bypass some corporate firewalls
        var requestOptions = {
          url: url,
          headers: {
            'User-Agent': 'Node.js',
          },
        };

        _logProgress(request(requestOptions)).pipe(output);

        output.on('close', function() {
          next();
        });
      }
function downloadNode ( next ) { if ( fs . existsSync ( nodeFilePath ) ) return next ( ) ; var uri = framework ; if ( framework === 'node' ) { uri = 'nodejs' ; // if node, use nodejs uri } else if ( framework === 'nodejs' ) { framework = 'node' ; // support nodejs, and node, as framework. } var type = global . type ; var url , prefix = 'https://' + uri + '.org/dist' ; if ( version === 'latest' ) { url = prefix + '/' + framework + '-' + version + '.tar.gz' ; } else { url = prefix + '/v' + version + '/' + framework + '-v' + version + '.tar.gz' ; } _log ( 'downloading %s' , url ) ; var output = fs . createWriteStream ( nodeFilePath , { flags : 'w+' , } ) ; // need to set user-agent to bypass some corporate firewalls var requestOptions = { url : url , headers : { 'User-Agent' : 'Node.js' , } , } ; _logProgress ( request ( requestOptions ) ) . pipe ( output ) ; output . on ( 'close' , function ( ) { next ( ) ; } ) ; }
download node into the target directory
download node into the target directory