<commit_before>import https from 'https';
import url from 'url';
import fs from 'fs';

export const loadViaNode = (fileUrl, onLoaded) => {
  let data = '';
  let options = url.parse(fileUrl);
  options.headers = {'User-Agent': ''}; // github wants a user agent header
  var request = https.request(options, function(res) {
    res.on('data', function(chunk) {data += chunk;});
    res.on('end', function() {
      const parsed = JSON.parse(data);
      if (!parsed.items) {
        onLoaded(null, JSON.parse(fs.readFileSync('../for-offline/data.json')));
      } else {
        onLoaded(null, parsed);
      }
    })
  });
  request.on('error', function(e) { onLoaded(e); });
  request.end();
};
<commit_msg>The URL is http now.<commit_after>import http from 'http';
import url from 'url';
import fs from 'fs';

export const loadViaNode = (fileUrl, onLoaded) => {
  let data = '';
  let options = url.parse(fileUrl);
  options.headers = {'User-Agent': ''}; // github wants a user agent header
  var request = http.request(options, function(res) {
    res.on('data', function(chunk) {data += chunk;});
    res.on('end', function() {
      const parsed = JSON.parse(data);
      if (!parsed.items) {
        onLoaded(null, JSON.parse(fs.readFileSync('../for-offline/grouped-metadata.json')));
      } else {
        onLoaded(null, parsed);
      }
    })
  });
  request.on('error', function(e) { onLoaded(e); });
  request.end();
};

{'fraction_non_alphanumeric': 0.1829608938547486, 'fraction_numerical': 0.0, 'mean_word_length': 3.2776119402985073, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6237543', 'n_tokens_mistral': 466, 'n_tokens_neox': 465, 'n_words': 112}