{"_id":"node-notifier@12.0.0","bugs":{"url":"https://github.com/mikaelbr/node-notifier/issues"},"dist":{"shasum":"5c6d8f002959d920c44d782aad256e9747fbe12c","tarball":"http://registry-npm.ywwl.com/node-notifier/download/node-notifier-12.0.0.tgz","fileCount":26,"integrity":"sha512-ivl1zYL//aTjkCEAtKUqrmCVy0BzWgU98SLGnVCKwPv0gRLwVpPyHvPDcx9skPP5utvscykCHX2YRH+6SpA2Jw==","signatures":[{"sig":"MEUCIQCPjeYdFO+hYiJKypZKWAe+g1c0W83D1xO1JvjPkloi3QIgN8D7sVt1XlmEIdUwcoNNB3FnOpzsdcp9yhASaxlrmEA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGKGB2tcX55fvdCsgClIXl3Qw5XUJ/syFa7c4noj86IJAiEAilso0OvLyIDikSom/ddpg+5ssGcyFmIYh5qimeraLzc="}],"unpackedSize":6070858,"size":2077793,"noattachment":false,"key":"/node-notifier/-/node-notifier-12.0.0.tgz"},"name":"node-notifier","type":"module","author":{"name":"Mikael Brevik"},"engines":{"node":"^22.22.2 || ^24.15.0 || >=26.0.0"},"exports":{".":"./index.js","./notifiers/*":"./notifiers/*.js","./package.json":"./package.json","./notifiers/*.js":"./notifiers/*.js"},"gitHead":"ac95d56c998e2c768a0dcd5dbb03e8737fdc3695","license":"MIT","scripts":{"lint":"biome check","test":"vitest run","format":"biome check --write","example":"node ./example/message.js","prepare":"husky","pretest":"pnpm run lint","example:mac":"node ./example/advanced.js","example:windows":"node ./example/toaster.js","test:integration":"vitest run --config vitest.integration.config.js","example:mac:input":"node ./example/macInput.js","example:linux:actions":"node ./example/notify-send-actions.js","example:windows:actions":"node ./example/toaster-with-actions.js","example:windows:custom-path":"cross-env DEBUG=notifier node ./example/toaster-custom-path.js"},"version":"12.0.0","_npmUser":{"name":"mikaelb","email":"mikaelbre@gmail.com"},"homepage":"https://github.com/mikaelbr/node-notifier#readme","keywords":["notification center","macos","notify","terminal-notifier","notify-send","growl","windows 8 notification","toaster","notification"],"repository":{"url":"git+https://github.com/mikaelbr/node-notifier.git","type":"git"},"_npmVersion":"11.16.0","description":"A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)","directories":{},"lint-staged":{"*.{js,json,css}":["biome check --write --no-errors-on-unmatched"]},"maintainers":[{"name":"mikaelb","email":"mikaelbre@gmail.com"}],"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"growly":"^1.3.0","is-wsl":"^3.1.1"},"_hasShrinkwrap":false,"packageManager":"pnpm@12.10.1+sha512.ba40a37eb1a370d60fea8c4cf1d364c13bcccef518e98ad2bcee954f539d38da37458e58261a3fa55e06523450ea0ffff9f497b135be41f2c15c1642bacace6c","devDependencies":{"husky":"^9.1.7","vitest":"^5.0.5","cross-env":"^10.1.0","lint-staged":"^17.6.0","@biomejs/biome":"2.6.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/node-notifier_12.0.0_1793212758511_0.9364453787830473"},"readme":"# node-notifier [![NPM version][npm-image]][npm-url] [![Install size][size-image]][size-url] [![Build Status][ci-image]][ci-url]\n\nSend native desktop notifications from Node.js on macOS, Windows and Linux.\nUses Notification Center on macOS, Toasts on Windows 8+ (taskbar balloons on older\nWindows) and `notify-send` on Linux, with Growl as a fallback.\n[Works with Electron](#electron).\n\n![macOS Screenshot](https://raw.githubusercontent.com/mikaelbr/node-notifier/master/example/mac.png)\n![Native Windows Screenshot](https://raw.githubusercontent.com/mikaelbr/node-notifier/master/example/windows.png)\n\n## Install\n\n```shell\nnpm install node-notifier\n```\n\nRequires Node.js 22.22+, 24.15+ or 26+. The package is ES modules only, but\n`require('node-notifier')` still works through Node's `require(esm)` support.\n\nLooking for a CLI? See [node-notifier-cli](https://github.com/mikaelbr/node-notifier-cli).\n\n## Usage\n\n```javascript\nimport notifier from 'node-notifier';\n\nnotifier.notify('Message');\n\nnotifier.notify(\n  {\n    title: 'My notification',\n    message: 'Hello, there!',\n    icon: '/absolute/path/to/icon.png', // Not supported on macOS or balloons\n    sound: true,\n    actions: ['OK', 'Cancel'] // Waits for the user (macOS, Windows, Linux)\n  },\n  (error, response, metadata) => {\n    // metadata.activationType, and metadata.activationValue for actions and replies\n  }\n);\n\nnotifier.on('click', (notifierObject, options, event) => {});\nnotifier.on('timeout', (notifierObject, options) => {});\n```\n\nThe default `notifier` picks the right notifier for your platform (see the\n[decision flow](./DECISION_FLOW.md)). Options that a platform doesn't support are\nignored. To tune options per platform, use a notifier directly:\n\n```javascript\nimport {\n  NotificationCenter, // macOS\n  WindowsToaster, // Windows 8+\n  WindowsBalloon, // Windows < 8\n  NotifySend, // Linux\n  Growl\n} from 'node-notifier';\n\nnew NotifySend(options).notify(notification, callback);\n```\n\n### Requirements\n\n- **macOS**: 10.14 or newer.\n- **Windows**: 8 or newer for Toasts. Earlier versions use taskbar balloons.\n- **Linux**: `notify-send` (`libnotify-bin` on Debian/Ubuntu).\n- **Other**: [Growl](https://github.com/growl/growl) running.\n\n## `NotificationCenter` (macOS)\n\nWraps the bundled [`terminal-notifier`](https://github.com/julienXX/terminal-notifier) 3.0.0\n(universal binary for Intel and Apple silicon). Other `terminal-notifier` flags can be\npassed as options, e.g. `-group` becomes `{ group: 'id' }`.\n\n```javascript\nimport { NotificationCenter } from 'node-notifier';\n\nconst notifier = new NotificationCenter({\n  withFallback: false, // Use Growl on macOS < 10.14\n  customPath: undefined // Path to your own terminal-notifier binary\n});\n\nnotifier.notify(\n  {\n    title: undefined,\n    subtitle: undefined,\n    message: undefined,\n    sound: false, // true ('Bottle') or a name: Basso, Blow, Bottle, Frog, Funk, Glass, Hero, Morse, Ping, Pop, Purr, Sosumi, Submarine, Tink\n    contentImage: undefined, // Absolute path to a local image\n    open: undefined, // URL to open on click\n    group: undefined, // Notifications in the same group replace each other\n    actions: undefined, // String | Array<String>. Action buttons\n    reply: false, // Boolean | String. Adds a text field, a string is used as placeholder\n    timeout: 10, // Seconds to wait for actions/reply, or false to wait forever\n    wait: false // Shorthand for timeout: 5\n  },\n  (error, response, metadata) => {}\n);\n```\n\n- Only notifications with `actions` or `reply` wait for the user. Others call the\n  callback right away and emit no `click` or `timeout` events.\n- `metadata.activationType` is `contentsClicked`, `actionClicked`, `replied`,\n  `closed` or `timeout`.\n- A waiting notification keeps your process alive. Call `notifier.clearAll()` to\n  stop waiting on all notifications from that instance.\n- `icon` is not supported. macOS always shows the icon of the sending app. For a\n  custom icon, build `terminal-notifier` with your icon\n  (`make icon ICON=logo.png APP_NAME=my-tool`) and point `customPath` to it.\n- macOS asks for notification permission the first time a notification is sent.\n\nSee [`example/macInput.js`](./example/macInput.js) for actions and reply.\n\n## `WindowsToaster` (Windows 8+)\n\nUses [SnoreToast](https://invent.kde.org/libraries/snoretoast).\n\n```javascript\nimport { WindowsToaster } from 'node-notifier';\n\nconst notifier = new WindowsToaster({\n  withFallback: false, // Use balloons on Windows < 8\n  customPath: undefined // Path to your own SnoreToast.exe\n});\n\nnotifier.notify(\n  {\n    title: undefined,\n    message: undefined, // Required unless `remove` is set\n    icon: undefined, // Absolute path to a PNG, max 1024×1024 px and 200 KB\n    sound: false, // true, or a Windows sound such as 'Notification.Mail'\n    actions: undefined, // Array<String>. Action buttons\n    appID: undefined, // Your app's ID. Without it the toast shows \"SnoreToast\"\n    id: undefined, // Number. ID to use with `remove`\n    remove: undefined, // Number. ID of a notification to close\n    duration: undefined, // 'short' (~7s, default) or 'long' (~25s)\n    install: undefined, // Creates a Start menu shortcut for `appID`\n    application: undefined // Executable to start when clicked after node-notifier stopped listening\n  },\n  (error, response, metadata) => {}\n);\n```\n\n- **Set `appID`** to the ID your app registered at install (e.g.\n  `com.squirrel.your.app` with Squirrel). Otherwise the toast shows \"SnoreToast\".\n- Toasts always wait for the user. `wait` and `timeout` don't change how long a\n  toast is shown, use `duration`. After that it stays in the Action Center.\n- Choosing an action emits an event named after the lower-cased label. See\n  [`example/toaster-with-actions.js`](./example/toaster-with-actions.js).\n- On 32-bit Windows the bundled SnoreToast is 0.7.0: `duration` is ignored, and\n  clicks with a custom `appID` aren't reported. Use `customPath` with a newer\n  SnoreToast to get both.\n- No toasts? Check that banners are enabled for the app under\n  Settings › System › Notifications.\n\n## `WindowsBalloon` (Windows < 8)\n\nUses [notifu](http://www.paralint.com/projects/notifu/).\n\n```javascript\nimport { WindowsBalloon } from 'node-notifier';\n\nnew WindowsBalloon({ withFallback: false, customPath: undefined }).notify(\n  {\n    title: undefined,\n    message: undefined,\n    sound: false,\n    time: 5000, // Milliseconds to show the balloon\n    wait: false,\n    type: 'info' // info | warn | error\n  },\n  (error, response) => {}\n);\n```\n\n## `NotifySend` (Linux)\n\n```javascript\nimport { NotifySend } from 'node-notifier';\n\nnew NotifySend().notify(\n  {\n    title: 'Foo',\n    message: 'Hello World',\n    icon: '/absolute/path/to/icon.png',\n    timeout: 10, // Seconds before the notification expires\n    actions: undefined, // String | Array<String>. Requires notify-send 0.7.10+\n    transient: false, // Don't keep it in the notification history\n    'app-name': 'node-notifier',\n    urgency: undefined, // low | normal | critical\n    category: undefined,\n    hint: undefined\n  },\n  (error, response, metadata) => {}\n);\n```\n\n- Only notifications with `actions` wait for the user. Choosing an action emits\n  `click` with the label in `metadata.activationValue`, running out of time emits\n  `timeout`. See [`example/notify-send-actions.js`](./example/notify-send-actions.js).\n- `actions` needs libnotify 0.7.10+ (e.g. Ubuntu 24.04, Debian 12) and a\n  notification daemon that supports actions.\n- See [`notify-send(1)`](https://man.archlinux.org/man/notify-send.1) for all flags.\n\n## `Growl`\n\n```javascript\nimport fs from 'node:fs';\nimport { Growl } from 'node-notifier';\n\nnew Growl({ name: 'My App', host: 'localhost', port: 23053 }).notify({\n  title: 'Foo',\n  message: 'Hello World',\n  icon: fs.readFileSync('/path/to/icon.png'),\n  sticky: false\n});\n```\n\nSee [growly](https://github.com/theabraham/growly/) for more options.\n\n## Common issues\n\n### WSL\n\nUnder WSL, notifications are shown in Windows. To use Linux notifications instead\n(with an X server and a notification daemon), start the process with:\n\n```sh\nNODE_NOTIFIER_WSL_NOTIFIER=linux node app.js\n```\n\nIt is read when `node-notifier` is imported, so setting `process.env` later has no\neffect. You can also use `NotifySend` directly.\n\nWindows can only show icons from a Windows drive. An `icon` on a mounted drive\n(e.g. `/mnt/c/Users/me/icon.png`) is converted to its Windows path, other icons are\nskipped. If you copied the package without keeping file permissions, run\n`chmod +x` on the `.exe` files in `vendor/`.\n\n### Cron, PM2 and services\n\nNotifications are shown on the desktop of the logged-in user, so the process must\nrun as that user while they are logged in.\n\n- **Linux:** cron and some process managers start without the session environment,\n  so `notify-send` can't reach the session bus. Set `XDG_RUNTIME_DIR` (and\n  `DBUS_SESSION_BUS_ADDRESS` if needed):\n\n  ```sh\n  * * * * * XDG_RUNTIME_DIR=/run/user/$(id -u) DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus node /path/to/app.js\n  ```\n\n  With PM2, run it as the desktop user (not root), or set the same variables.\n- **Windows:** services running as `SYSTEM` can't show notifications. Make the\n  service (or PM2) log on as the logged-in user.\n\n### Electron\n\nBinaries can't run from inside an `asar` archive. Unpack the `vendor/` folder:\n\n```shell\nasar pack . app.asar --unpack \"./node_modules/node-notifier/vendor/**\"\n```\n\nOr with `electron-builder`, in `package.json`:\n\n```json\n\"build\": {\n  \"asarUnpack\": [\"./node_modules/node-notifier/**/*\"]\n}\n```\n\n### Bundlers (webpack, etc.)\n\n`node-notifier` finds its bundled binaries relative to its own files, so keep it out\nof the bundle. In webpack:\n\n```javascript\nexternals: {\n  'node-notifier': 'commonjs node-notifier'\n}\n```\n\n## Thanks\n\n`node-notifier` is made possible by\n[`terminal-notifier`](https://github.com/julienXX/terminal-notifier),\n[SnoreToast](https://invent.kde.org/libraries/snoretoast),\n[notifu](http://www.paralint.com/projects/notifu/) and\n[growly](https://github.com/theabraham/growly/).\n\n## License\n\n[MIT](./LICENSE). The vendored [SnoreToast](./vendor/snoreToast/LICENSE) (LGPL-3),\n[notifu](./vendor/notifu/LICENSE) (BSD 3-Clause) and\n[terminal-notifier](./vendor/terminal-notifier-LICENSE) have their own licenses. See\n[`vendor/snoreToast/README.md`](./vendor/snoreToast/README.md) for the versions and\nsource of the bundled SnoreToast binaries.\n\n[npm-url]: https://npmjs.org/package/node-notifier\n[npm-image]: https://img.shields.io/npm/v/node-notifier.svg?style=flat\n[size-url]: https://packagephobia.com/result?p=node-notifier\n[size-image]: https://badgen.net/packagephobia/install/node-notifier\n[ci-url]: https://github.com/mikaelbr/node-notifier/actions/workflows/test.yml\n[ci-image]: https://github.com/mikaelbr/node-notifier/actions/workflows/test.yml/badge.svg\n","publish_time":1793212758649,"_cnpm_publish_time":1793212758649,"dist-tags":{"latest":"12.1.0"}}