From 5c6488181256fbaa37c01c9f497dab55dafccd99 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sat, 4 May 2024 06:29:53 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 0f09c3a [ci skip] [skip ci] --- tests/lib.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/lib.ts b/tests/lib.ts index afe5979..a1a3e11 100644 --- a/tests/lib.ts +++ b/tests/lib.ts @@ -1,11 +1,10 @@ import 'dotenv/config'; -import XDCC from '../src' -import { env } from 'process' +import { env } from 'process'; +import XDCC from '../src'; const xdccJS = new XDCC({ host: env.SERVER, -}) - +}); function msToReadableTime(ms: number) { const seconds = Math.floor(ms / 1000); @@ -28,15 +27,14 @@ function msToReadableTime(ms: number) { return readableString; } - -xdccJS.on('ready', ()=> { - xdccJS.download(env.BOT, env.PACK) +xdccJS.on('ready', () => { + xdccJS.download(env.BOT, env.PACK); let lastTime = Date.now(); xdccJS.on('downloading', (fileinfo, received, percentage, eta) => { - if(lastTime + 500 < Date.now()) { - lastTime = Date.now() - console.log(`Downloading ${fileinfo.file} - ${received}/${fileinfo.length} - (${percentage}%) @ETA (${msToReadableTime(eta)})`) + if (lastTime + 500 < Date.now()) { + lastTime = Date.now(); + console.log(`Downloading ${fileinfo.file} - ${received}/${fileinfo.length} - (${percentage}%) @ETA (${msToReadableTime(eta)})`); } - }) + }); xdccJS.on('done', () => console.log('done')); -}) \ No newline at end of file +});