2015-02-13 15:18:24 -04:00
|
|
|
var binary = require('node-binary');
|
2015-02-13 15:35:28 -04:00
|
|
|
var fs = require('fs');
|
|
|
|
var path = require('path');
|
|
|
|
var nodeVersion = require('../package.json').bundled_engine;
|
|
|
|
var destination = './bin/node';
|
2015-02-13 15:18:24 -04:00
|
|
|
|
|
|
|
console.log('Downloading node-' + nodeVersion + '-' + process.platform + '-' + process.arch);
|
|
|
|
|
|
|
|
binary.download({
|
|
|
|
os: process.platform,
|
|
|
|
arch: process.arch,
|
|
|
|
version: nodeVersion
|
2015-02-13 15:35:28 -04:00
|
|
|
}, destination, function(error, binaryPath) {
|
2015-02-13 15:18:24 -04:00
|
|
|
if(error) {
|
|
|
|
console.error(error.message);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
2015-02-13 15:35:28 -04:00
|
|
|
var output = path.join(destination, 'node-' + process.platform + '-' + process.arch);
|
|
|
|
fs.renameSync(binaryPath, output);
|
|
|
|
|
|
|
|
console.log('NodeJS downloaded to ' + output);
|
2015-02-13 15:18:24 -04:00
|
|
|
});
|