<commit_before>#!/usr/bin/env node

const meow = require('meow')
const speedTest = require('speedtest-net')
const updateNotifier = require('update-notifier')

// silly usage for tests
const cli = new meow([
  'Usage'
])

// check for updates
updateNotifier({ pkg: cli.pkg }).notify()

let st = speedTest({ maxTime: 15000 })

st.on('data', data => {
  let download = data.speeds.download
  let upload = data.speeds.upload

  console.log('Download speed: ' + download + 'kB/s')
  console.log('Upload speed: ' + upload + 'kB/s')

  console.log({data})
})

st.on('downloadprogress', progress => {
  console.log('Download progress -> ' + progress + '%')
})

st.on('uploadprogress', progress => {
  console.log('Upload progress -> ' + progress + '%')
})

st.on('error', err => {
  console.error(err)
})<commit_msg>fix errors with speed<commit_after>#!/usr/bin/env node

const meow = require('meow')
const speedTest = require('speedtest-net')
const updateNotifier = require('update-notifier')

// silly usage for tests
const cli = new meow([
  'Usage'
])

// check for updates
updateNotifier({ pkg: cli.pkg })  .notify()

let st = speedTest({ maxTime: 20000 })

st.on('data', data => {
  let download = (data.speeds.download * 100).toFixed(2)
  let upload = (data.speeds.upload * 100).toFixed(2)
  let ping = data.server.ping

  console.log('\nFinal results:')
  console.log('Download speed: ' + download + ' kB/s')
  console.log('Upload speed: ' + upload + ' kB/s')
  console.log('Latency: ' + ping + ' ms')

  // console.log({data})
})

st.on('downloadspeedprogress', speed => {
  console.log('Download: ' + (speed * 100).toFixed(2) + ' kB/s')
})
st.on('uploadspeedprogress', speed => {
  console.log('Upload: ' + (speed * 100).toFixed(2) + ' kB/s')
})

st.on('error', err => {
  console.error(err)
})
{'fraction_non_alphanumeric': 0.19265033407572382, 'fraction_numerical': 0.014476614699331848, 'mean_word_length': 4.0195530726256985, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '429564', 'n_tokens_mistral': 655, 'n_tokens_neox': 623, 'n_words': 139}