A native messaging host for Chrome and Firefox with a simple API and no dependencies.
npm i node-native-messaging-host
import initNativeMessagingHost from 'node-native-messaging-host';
// Initialize
const nm = initNativeMessagingHost();
// Add a callback that will be fired each time a new message is
// received from the extension.
nm.addOnMessageListener(message => {
console.log(`Received ${message} from extension`);
});
// Send a message to the extension
nm.send({ answer: 42 });
- tests