<commit_before>/**
 * Created by <NAME> on 10/04/17.
 */

interface Nightly {
    version: string;
    date: string;
}

const nightlyBaseUrl: string = "http://nodejs.org/download/nightly/";
const request = require('request');
const fs = require('fs-extra');
const path = require('path');
const exec = require('child_process').exec;
const DOWNLOAD_NAME: string = `tmp/node-v8${getPlatform()}`;
const NODE_PATH = "node-v8";
let fileName: string = null;

//Clean old files
if (fs.existsSync(NODE_PATH)) {
    fs.removeSync(NODE_PATH);
}
if (!fs.existsSync("tmp")) {
    fs.mkdirSync("tmp");
}

console.log("##########################################");
console.log("#   Installing node.js with webassembly  #");
console.log("##########################################");

request.get(nightlyBaseUrl + "index.json", function (error, response, body: string) {
    let nightlyInfo: Nightly[] = JSON.parse(body);
    let downloadUrl = generateDownloadUrl(nightlyInfo);
    if (downloadUrl) {
        startDownload(downloadUrl);
    }
});

function generateDownloadUrl(nightlyInfo: Nightly[]): string {
    //Just take first entry, assuming it is the latest.
    let latest: Nightly = nightlyInfo[0];
    fileName = "node-" + latest.version + getPlatform();
    return nightlyBaseUrl + latest.version + "/" + fileName;
}

function getPlatform(): string {
    let os = process.platform;

    switch (os) {
        case "win32":
            return "-win-x64.7z";
        case "darwin":
            return "-darwin-x64.tar.xz";
        case "linux":
            return "-linux-x64.tar.xz";
    }
}

function startDownload(url) {<commit_msg>Just download the second nightly from the list<commit_after>/**
 * Created by <NAME> on 10/04/17.
 */

interface Nightly {
    version: string;
    date: string;
}

const nightlyBaseUrl: string = "http://nodejs.org/download/nightly/";
const request = require('request');
const fs = require('fs-extra');
const path = require('path');
const exec = require('child_process').exec;
const DOWNLOAD_NAME: string = `tmp/node-v8${getPlatform()}`;
const NODE_PATH = "node-v8";
let fileName: string = null;

//Clean old files
if (fs.existsSync(NODE_PATH)) {
    fs.removeSync(NODE_PATH);
}
if (!fs.existsSync("tmp")) {
    fs.mkdirSync("tmp");
}

console.log("##########################################");
console.log("#   Installing node.js with webassembly  #");
console.log("##########################################");

request.get(nightlyBaseUrl + "index.json", function (error, response, body: string) {
    let nightlyInfo: Nightly[] = JSON.parse(body);
    let downloadUrl = generateDownloadUrl(nightlyInfo);
    if (downloadUrl) {
        startDownload(downloadUrl);
    }
});

function generateDownloadUrl(nightlyInfo: Nightly[]): string {
    //Just take the 'second' entry, assuming it is the latest 'completely uploaded'.
    let latest: Nightly = nightlyInfo[1];
    fileName = "node-" + latest.version + getPlatform();
    return nightlyBaseUrl + latest.version + "/" + fileName;
}

function getPlatform(): string {
    let os = process.platform;

    switch (os) {
        case "win32":
            return "-win-x64.7z";
        case "darwin":
            return "-darwin-x64.tar.xz";
        case "linux":
            return "-linux-x64.tar.xz";
    }
}

function startDownload(url) {
{'fraction_non_alphanumeric': 0.19759036144578312, 'fraction_numerical': 0.010843373493975903, 'mean_word_length': 3.6973125884016973, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7456619', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1012, 'n_words': 248}