Using Yarn
yarn add node-mac-file-icon
Using NPM
npm install node-mac-file-icon
Add to main process
import { getIcon } from 'node-mac-file-icon';
await getIcon('/Applications/Pages.app', './pages.png', 240)
The package is available as open source under the terms of the MIT License.