How to get all apps that is installed from microsoft store in windows with nodejs?

If i scan C:/Program Files/WindowsApps/ ,it will return permission error.

How could i get the list of windows apps from microsoft store?

The error is operation not permitted, scandir 'C:/Program Files/WindowsApps'

//I use glob to scan all the exe in the windowsApps dictionary
const glob = require("glob");
const exes = []
const filePattern = path.resolve(startMenu, "**/*.exe").replace(/\\/g, "/");
  // console.log(filePattern);
exes.push(glob.sync(filePattern));

Solution 1:

To simply get names of directories within C:/Program Files/WindowsApps you could do:

const folder = 'C:/Program Files/WindowsApps';
const fs = require('fs');

fs.readdir(folder, (err, files) => {
  files.forEach((file, index) => {
    console.log((index + 1) + ') ' + file);
  });
});

The result would look like this:

1) AppleInc.iCloud_13.0.201.0_x86_...
2) Microsoft.MicrosoftEdge.Stable_89.0.774.68...
3) Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x64__...
...