在javascript中将Uint8Array转换为字符串

在javascript中将Uint8Array转换为字符串,javascript,node.js,electron,Javascript,Node.js,Electron,我正在运行where*.exe以在electron应用程序中列出windows中的所有exe,然后启动一些应用程序。它以Uint8Array格式返回结果 const { execSync } = require('child_process'); const exeFiles=execSync('where *.exe'); console.log( exeFiles); // this returns [97, 92,79,....] console.log(exeFiles.toString

我正在运行where*.exe以在electron应用程序中列出windows中的所有exe,然后启动一些应用程序。它以Uint8Array格式返回结果

const { execSync } = require('child_process');
const exeFiles=execSync('where *.exe');
console.log( exeFiles); // this returns [97, 92,79,....]
console.log(exeFiles.toString());
// returns
//C:\Windows\System32\cacls.exe                                                                                           //C:\Windows\System32\calc.exe...        
我希望结果是

[C:\Windows\System32\cacls.exe,C:\Windows\System32\calc.exe,...]        

如果希望结果作为数组,可以基于换行符拆分字符串 并删除最后一个元素

const resultArray = exeFiles.toString().split("\n")
resultArray.pop() // since last element will be empty string
console.log(resultArray);