Skip to content

Instantly share code, notes, and snippets.

@LukaszWiktor
Created January 2, 2023 07:58
Show Gist options
  • Save LukaszWiktor/80d2423072a7b88ec14d7688ff9b7433 to your computer and use it in GitHub Desktop.
Save LukaszWiktor/80d2423072a7b88ec14d7688ff9b7433 to your computer and use it in GitHub Desktop.
Display a system notification in macOS from a Node.js script.
const { exec } = require("child_process");
exec(`osascript -e 'display notification "Hello World!"'`, (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment