diff --git a/src/js/main.js b/src/js/main.js index b9858c05..b47e75c2 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -49,7 +49,7 @@ async function main() { stdio.info(`Computed prettify options: ${JSON.stringify(finalConfig)}`); - const fileContents = constants.USING_EDITOR_TEXT_TEMP_FILE === 'True' + const bufferContents = constants.USING_EDITOR_TEXT_TEMP_FILE === 'True' ? await fs.readFile(constants.EDITOR_TEXT_TEMP_FILE_PATH, { encoding: 'utf8' }) : constants.EDITOR_TEXT_TEMP_FILE_CONTENTS; @@ -57,31 +57,31 @@ async function main() { stdio.info('Attempting to prettify what seems to be a CSS file.'); stdio.endDiagnostics(); stdio.beginPrettifiedCode(); - stdio.out(beautify.css(fileContents, finalConfig.css)); + stdio.out(beautify.css(bufferContents, finalConfig.css)); stdio.endPrettifiedCode(); - } else if (isHTML(fileContents)) { + } else if (isHTML(bufferContents)) { stdio.info('Attempting to prettify what seems to be a HTML file.'); stdio.endDiagnostics(); stdio.beginPrettifiedCode(); - stdio.out(beautify.html(fileContents, finalConfig.html)); + stdio.out(beautify.html(bufferContents, finalConfig.html)); stdio.endPrettifiedCode(); - } else if (isJSON()) { + } else if (isJSON(bufferContents)) { stdio.info('Attempting to prettify what seems to be a JSON file.'); stdio.endDiagnostics(); stdio.beginPrettifiedCode(); - stdio.out(beautify.js(fileContents, finalConfig.json)); + stdio.out(beautify.js(bufferContents, finalConfig.json)); stdio.endPrettifiedCode(); - } else if (isJS(fileContents)) { + } else if (isJS(bufferContents)) { stdio.info('Attempting to prettify what seems to be a JS file.'); stdio.endDiagnostics(); stdio.beginPrettifiedCode(); - stdio.out(beautify.js(fileContents, finalConfig.js)); + stdio.out(beautify.js(bufferContents, finalConfig.js)); stdio.endPrettifiedCode(); } else { stdio.info('Unsupported file type'); stdio.endDiagnostics(); stdio.beginPrettifiedCode(); - stdio.out(fileContents); + stdio.out(bufferContents); stdio.endPrettifiedCode(); } }