<commit_before>const fs = require('fs'), os = require('os');
const sqlite = require('sqlite3');

var out = fs.createWriteStream('tweets.csv');
out.write('ID\tUser\tTimestamp' + os.EOL);

var db = new sqlite.Database('tweets.db', function(err) {
  if (err) throw err;
  db.each('SELECT tweet_id, user, timestamp, body FROM tweets', (err, row) => {
    if (err) throw err;
    out.write([row.tweet_id, row.user, row.timestamp].join('\t') + os.EOL);
  }, (err, n) => {
    if (err) throw err;
    console.log('wrote %d rows', n);
    out.end((err) => {
      if (err) throw err;
    });
  })
});<commit_msg>Write CSV file with Julian date<commit_after>const fs = require('fs'), os = require('os');
const sqlite = require('sqlite3');

var out = fs.createWriteStream('tweets.csv');
out.write('ID,User,Time' + os.EOL);

var db = new sqlite.Database('tweets.db', function(err) {
  if (err) throw err;
  db.each("SELECT tweet_id, user, julianday(timestamp) - julianday('1900-01-01') AS date, body FROM tweets", (err, row) => {
    if (err) throw err;
    out.write([row.tweet_id, row.user, row.date].join(',') + os.EOL);
  }, (err, n) => {
    if (err) throw err;
    console.log('wrote %d rows', n);
    out.end((err) => {
      if (err) throw err;
    });
  })
});
{'fraction_non_alphanumeric': 0.20588235294117646, 'fraction_numerical': 0.00794912559618442, 'mean_word_length': 3.6977611940298507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1809382', 'n_tokens_mistral': 482, 'n_tokens_neox': 468, 'n_words': 116}