Lightweight pipe-based IPC for Bare.
npm i bare-ipc
IPCconst [portA, portB] = IPC.open(opts)Returns a pair of IPCPorts for use constructing the IPC duplex stream based on
bare-pipe.
const ipc = new IPC(port)Returns a duplex stream using the provided port. See streamx's Duplex for Duplex API.
ipc.ref()Increase the reference count for the IPC to keep the event loop alive.
A common pattern is to ipc.ref() on Bare.on('resume') and ipc.unref() on
suspend like so:
Bare.on('suspend', () => ipc.unref()).on('resume', () => ipc.ref())
ipc.unref()Decrease the reference count for the IPC to allow the event loop to exit.
See ipc.ref() for common pattern to keep the event loop alive.
IPCPortconst port = new IPCPort(incoming, outgoing)The arguments are:
incoming is the read file handleoutgoing is the write file handleport.connect()Returns an IPC connected to the port.
port.detachedA boolean for whether the port is detached.
Apache-2.0