procomm
TypeScript icon, indicating that this package has built-in type declarations

0.1223.2 • Public • Published

Scpos Inter-Process Communication Library

procomm can make file-to-file IPC come ture. Through elegant method chain, you can let the JS file running in different processes communicate alone with each other by "listen" and "tell".

Initialization

To initialize procomm, you need:

const procomm = require('procomm')(__filename);
// or
import procommIniter from 'procomm';
const procomm = procommIniter(__filename);

Usage

Send message to JS file ./dad.js running in father process:

procomm.tell('dad', 'hello');

Send message to ./folder/son.js in child process:

const subProce = child_process.fork(path.join(__dirname, 'folder/son'));
procomm.reProce(subProce).tell('folder/son', 'hello');

Listen message from ../dad.js in father process:

procomm.listen('../dad', msg => console.log(msg));

Listen message from /home/test/son.js in child process:

const subProce = child_process.fork('/home/test/son');
procomm.reProce(subProce).listen('/home/test/son.js', msg => console.log(msg));

Package Sidebar

Install

npm i procomm

Weekly Downloads

1

Version

0.1223.2

License

MIT

Unpacked Size

9.91 kB

Total Files

6

Last publish

Collaborators

  • e0selmy4v