Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
node-notifier
Advanced tools
A Node.js module for sending notifications on mac, windows and linux
The node-notifier package is a Node.js module for sending native notifications on different platforms like Windows, Mac, and Linux. It provides an easy-to-use API to show system notifications using the native notification system of the operating system.
Cross-platform notifications
This feature allows you to send desktop notifications across different operating systems. The code sample shows how to send a simple notification with a title and a message.
const notifier = require('node-notifier');
notifier.notify({
title: 'My notification',
message: 'Hello, this is a notification!'
});
Notification actions
This feature allows you to listen for user interactions with the notification, such as clicking on it. The code sample demonstrates how to handle a click event on the notification.
const notifier = require('node-notifier');
notifier.notify({
title: 'My notification',
message: 'Click to perform an action',
wait: true
}, (err, response, metadata) => {
if (metadata.activationType === 'clicked') {
console.log('Notification clicked!');
}
});
Custom notification sound
This feature allows you to customize the notification sound and appearance. The code sample shows how to send a notification with a custom sound and icon.
const notifier = require('node-notifier');
notifier.notify({
title: 'My notification',
message: 'With a custom sound!',
sound: true, // Only Notification Center or Windows Toasters
appIcon: '/path/to/icon.png', // Absolute path (doesn't work on balloons)
contentImage: '/path/to/image.png' // Absolute Path to Attached Image (Content Image)
});
A package specifically designed for Electron applications to show desktop notifications. It is similar to node-notifier but tailored for the Electron environment, which means it might not be suitable for non-Electron Node.js applications.
This package allows you to send notifications using the Pushover service. It differs from node-notifier in that it requires an internet connection and uses the Pushover API to send messages to devices, whereas node-notifier works offline and uses the native OS notification systems.
Toastr is a Javascript library for non-blocking notifications. It is designed for web applications and provides in-browser notifications as opposed to the system-level notifications provided by node-notifier.
A node module for sending notification using node. Uses terminal-notifier on mac, notify-send for Linux and growl for others.
For mac this is a wrapper for the terminal-notifier application by Eloy Durán.
If using Linux, notify-send
must be installed on your system.
However, terminal-notifier, comes
bundled in the module. So on Mac, not additional installations is necessary.
If using Windows/Growl, growl
must be installed. For windows see
Growl for Windows. You can also use
growl on mac, but you need to specify this manually (see API).
By default Notification Center will be used on Mac, notify-send will be used on Linux, and Growl will be used if neither mac or linux.
$ npm install node-notifier
var Notification = require('node-notifier');
var notifier = new Notification();
notifier.notify({
message: 'Hello World'
});
Notification
also has specifications for all types of notifications, to be used
manually.
Example:
var nn = require('node-notifier');
new nn.NotificationCenter().notify();
new nn.NotifySend().notify();
new nn.Growl().notify(options);
Same usage and parameter setup as terminal-notifier.
Where terminal-notifier say to use the -message
option, you can do this in node-notifier
var Notification = require('node-notifier');
var notifier = new Notification();
notifier.notify({
message: 'Hello World'
});
You can specify the second argument as a callback for getting error
and response
.
var Notification = require('node-notifier');
var notifier = new Notification();
notifier.notify({
title: 'My application',
message: 'New notification'
}, function(error, response) {
console.log(response);
});
The response will be given as an object. E.g., when running notifier.notify({list: "ALL"})
, this could be the response:
{ response:
[ { GroupID: null,
Title: 'Terminal',
Subtitle: null,
Message: 'Another message',
'Delivered At': Wed Dec 12 2012 15:23:38 GMT+0100 (CET) },
{ GroupID: null,
Title: 'Terminal',
Subtitle: null,
Message: 'Another message',
'Delivered At': Wed Dec 12 2012 15:23:31 GMT+0100 (CET) },
{ GroupID: 2,
Title: 'Terminal',
Subtitle: null,
Message: 'Testing',
'Delivered At': Wed Dec 12 2012 15:22:41 GMT+0100 (CET) },
{ GroupID: 1,
Title: 'Terminal',
Subtitle: null,
Message: 'Testing',
'Delivered At': Wed Dec 12 2012 15:22:29 GMT+0100 (CET) } ],
type: 'list' }
There are three different types:
deliviered
when a message is delivered.removed
when all or one message is removed. If all messages are removed, the response property will have several elements.list
when a list is presented. Even when doing list: 1
.var Notification = require('node-notifier');
var notifier = new Notification();
notifier.notify({
title: 'Foo',
message: 'Hello World'
// .. and other notify-send flags
});
var Notification = require('node-notifier');
var notifier = new Notification({
// Options as passed to Growler
});
notifier.notify({
title: 'Foo',
message: 'Hello World'
// and other growl options like sticky etc.
});
See more information for constructor options in growler.
FAQs
A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)
The npm package node-notifier receives a total of 5,767,618 weekly downloads. As such, node-notifier popularity was classified as popular.
We found that node-notifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.