diff --git a/backend/package-lock.json b/backend/package-lock.json index eaa788f..fd71a0a 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -769,6 +769,11 @@ "delayed-stream": "~1.0.0" } }, + "command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" + }, "compress-commons": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.1.tgz", diff --git a/backend/package.json b/backend/package.json index 3b14be4..3038d49 100644 --- a/backend/package.json +++ b/backend/package.json @@ -30,6 +30,7 @@ "async-mutex": "^0.4.0", "axios": "^0.21.2", "bcryptjs": "^2.4.0", + "command-exists": "^1.2.9", "compression": "^1.7.4", "config": "^3.2.3", "express": "^4.18.2", diff --git a/backend/twitch.js b/backend/twitch.js index b0ac965..2237bc9 100644 --- a/backend/twitch.js +++ b/backend/twitch.js @@ -6,6 +6,7 @@ const fs = require('fs-extra') const path = require('path'); const { promisify } = require('util'); const child_process = require('child_process'); +const commandExistsSync = require('command-exists').sync; async function getCommentsForVOD(vodId) { const exec = promisify(child_process.exec); @@ -20,7 +21,7 @@ async function getCommentsForVOD(vodId) { const cliExt = is_windows ? '.exe' : '' const cliPath = `TwitchDownloaderCLI${cliExt}` - if (!fs.existsSync(cliPath)) { + if (!commandExistsSync(cliPath)) { logger.error(`${cliPath} does not exist. Twitch chat download failed! Get it here: https://github.com/lay295/TwitchDownloader`); return null; }