bare-sidecar
Start and manage Bare sidecar processes from Node.js and Electron
stable
Source
Source
Source
Source
Source
Source
bare-sidecar — Start and manage Bare sidecar processes from Node.js and Electron.
npm i bare-sidecarUsage
In the host process:
const Sidecar = require('bare-sidecar')
const sidecar = new Sidecar(require.resolve('./entry'))
sidecar
.on('exit', (code, status) => {
// The sidecar process exited
})
.on('data', (data) => {
// Received data from the sidecar over IPC
})
.write('Hello sidecar')In the sidecar entry (entry.js), the IPC channel is available as a stream on Bare.IPC:
Bare.IPC.on('data', (data) => Bare.IPC.write(data))API
Sidecar
new Sidecar(entry: string, args?: string[], opts?: SidecarOptions)
Source
Spawn a bundled Bare runtime running entry and return a Sidecar. entry is the path to the module to run, typically resolved with require.resolve(). args is an array of additional command line arguments passed to the process. options is reserved for future use.
Overloads:
new Sidecar(entry: string, args?: string[], opts?: SidecarOptions)
new Sidecar(entry: string, opts?: SidecarOptions)Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
entry | string | — | Path to the module the sidecar process runs, typically resolved with require.resolve(). |
args? | string[] | — | Additional command-line arguments passed to the process (default []). |
opts? | SidecarOptions | — | Reserved for future use. |
stderr: Pipe | null
Source
The readable standard error stream of the underlying process.
stdin: Pipe | null
Source
The writable standard input stream of the underlying process.
stdout: Pipe | null
Source
The readable standard output stream of the underlying process.
Types
SidecarEvents
interface SidecarEvents extends DuplexEvents {
exit: [code: number | null, signalCode: string | null]
}SidecarOptions
interface SidecarOptions {}See also
- Bare modules — the full
bare-*catalog. - Bare runtime API — the runtime these modules extend.