
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
pear-runtime
Advanced tools
Embeddable Runtime library for Pear with P2P OTA updates, Bare workers and storage APIs
npm install pear-runtime
This module integrates Pear into JavaScript-based Desktop applications.
See pear-mobile for Pear's embeddable runtime module for Mobile Devices.
This library is MVP and Experimental.
const path = require('path')
const PearRuntime = require('pear-runtime')
const { version, upgrade } = require('./package.json')
function getAppPath() {
if (!app.isPackaged) return null
if (isLinux && process.env.APPIMAGE) return process.env.APPIMAGE
if (isWindows) return process.execPath
return path.join(process.resourcesPath, '..', '..')
}
const pear = new PearRuntime({
dir: path.join(__dirname, 'runtime-data'),
version,
upgrade,
app: getAppPath() // path to .app / .AppImage / .msix
})
pear.on('error', console.error) // log network errors etc.
pear.updater.on('updating', () => console.log('Updating...'))
pear.updater.on('updated', () => pear.updater.applyUpdate())
const worker = PearRuntime.run(require.resolve('./worker.js'))
worker.on('data', (data) => console.log('worker:', data.toString()))
// be sure to await pear.close() during process teardown
git clone https://github.com/holepunchto/hello-pear-electron
For end-to-end instructions from building to deploying with Pear see hello-pear-electron README.md.
Coming Soon
IPC <stream.Duplex> = PearRuntime.run(path, args = [], opts = {})alias: pear.run
Start a bare worker.
Returns a duplex stream, the IPC pipe.
In the worker, Bare.IPC is the other end of the pipe.
Worker stdio is available at IPC.stdin, IPC.stdout & IPC.stderr.
const pear = new PearRuntime(opts)opts.dir – (required) Directory to store data (e.g. app data dir).opts.upgrade – (required) Pear upgrade link (e.g. from package.json upgrade field).opts.name - (required) The package.json productName of the app.store - (optional) pass a Corestore to be used for updates. If passed swarm must also be passed. The store should be replicated over the swarm.swarm - (optional) pass a Hyperswarm to be used for swarming updates. If passed store must also be passed. The store should be replicated over the swarm.opts.version – (optional) Current app version; used to decide if an update should be stored.opts.app – (optional) Path to the app bundle (for bundled apps; used with applyUpdate()).opts.bundled – (optional) Whether the app is bundled. Defaults to !!opts.app.opts.updates – (optional) Set to false to opt out of updates.opts.storage – (optional) Set peer-to-peer application storage path.IPC <stream.Duplex> = pear.run(path, args = [], opts = {})alias: PearRuntime.run
Start a bare worker.
Returns a duplex stream, the IPC pipe.
In the worker, Bare.IPC is the other end of the pipe.
Worker stdio is available at IPC.stdin, IPC.stdout & IPC.stderr.
pear.storageSuggested storage folder for app storage.
await pear.ready()Resolves when ready. Initialization is eager, but can be used to determine when OTA updates are ready.
await pear.close()Shut down the embedded runtime, including OTA updates. For best performance, be sure to do this when closing the app.
VERY EXPERIMENTAL, MOST DEFINITELY WILL CHANGE.
Update listening and apply logic lives in pear-runtime-updater.
First allocate a pear link if you haven't using pear:
pear touch
Store this link in the package.json upgrade field of a project. See example.
Build an app. Take the distributable (e.g .app) produced and make a deployment folder with the following structure:
/package.json
/by-arch
/[...platform-arch]
/app
Now go to this folder and stage this onto the link with pear stage
pear stage {link-from-touch}
Now seed it. Any build out there on a lower version will trigger the update flow.
Apache-2.0
FAQs
Embeddable Pear Runtime
We found that pear-runtime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.