LogoPear Docs
ReferencesBareModules

bare-ipc

Reference for bare-ipc: lightweight pipe-based inter-process communication for Bare, with structured-clone message ports.

stable

bare-ipc provides lightweight pipe-based inter-process communication for Bare. It pairs two ports over bare-pipe and exchanges structured-cloned messages between them. It's pure JavaScript. (For the host↔worklet channel in native apps, see bare-kit instead.)

npm i bare-ipc

Usage

const IPC = require('bare-ipc')

const [portA, portB] = IPC.open()

const a = portA.connect()
const b = portB.connect()

a.on('data', (data) => { /* received from b */ }).end('hello b')

API

const [portA, portB] = IPC.open()

Create a connected pair of IPCPorts.

const ipc = new IPC(port)

Wrap a single transport port. Exposes ipc.incoming, ipc.outgoing, ipc.ref(), ipc.unref().

const port = new IPCPort(incoming, outgoing)

A port over explicit incoming/outgoing transports: port.connect() returns the message stream; port.incoming, port.outgoing, port.detached.

Builds on bare-pipe, bare-stream, and bare-structured-clone (see Bare modules).

See also

  • bare-channel—inter-thread messaging (same idea, within a process).
  • bare-kit—the host↔worklet IPC channel in native apps.
  • Bare modules—the full bare-* catalog.

On this page