LogoPear Docs
ReferencesBareModules

bare-sidecar

Reference for bare-sidecar: start and manage a Bare sidecar process from a Node.js or Electron host.

bare-sidecar starts and manages a Bare sidecar process from a Node.js or Electron host—a way to run a Bare core alongside a Node/Electron app and talk to it over its standard streams. It's pure JavaScript.

npm i bare-sidecar

Usage

const Sidecar = require('bare-sidecar')

const sidecar = new Sidecar(require.resolve('./entry'))

sidecar
  .on('data', (data) => { /* output from the sidecar */ })
  .on('exit', (code, status) => { /* the sidecar exited */ })

API

const sidecar = new Sidecar(entry[, args][, options])

Spawn a Bare process running entry, with optional args and options. The returned instance extends a duplex stream: writing to it sends data to the sidecar over its IPC channel, data received from the sidecar is emitted as 'data' events, and destroying the stream kills the sidecar process.

sidecar.stdin · sidecar.stdout · sidecar.stderr

The sidecar's standard streams.

event: "exit"(code, status)

Emitted when the sidecar process exits. code is the exit code, or null if the process was terminated by a signal. status is the signal name that terminated the process, or null if it exited normally.

event: "close"

Emitted after the sidecar process has exited and its underlying stream has been destroyed.

Builds on bare-subprocess, bare-pipe, bare-module, bare-fs, bare-os, bare-path, bare-stream, and bare-url (see Bare modules).

See also

On this page