# sync-rpc

> Run asynchronous commands synchronously by putting them in a separate process

Latest version **1.3.7** (published 2026-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install sync-rpc
pnpm add sync-rpc
yarn add sync-rpc
bun add sync-rpc
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.3.7 |
| Published | 2026-07-03 |
| First published | 2017-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 76 |
| Author | Forbes Lindesay |
| Maintainers | forbeslindesay |

## Links

- npm: https://www.npmjs.com/package/sync-rpc
- Repository: https://github.com/ForbesLindesay/sync-rpc
- Homepage: https://github.com/ForbesLindesay/sync-rpc#readme
- Issues: https://github.com/ForbesLindesay/sync-rpc/issues
- npm.io page: https://npm.io/package/sync-rpc

## Dependencies (1)

- [get-port](https://npm.io/package/get-port.md) ^3.1.0

## Recent versions

- 1.3.7 (latest) — 2026-07-03
- 1.3.6 — 2019-07-24
- 1.3.5 — 2019-07-24
- 1.3.4 — 2018-05-14
- 1.3.3 — 2018-03-02
- 1.3.2 — 2018-03-02
- 1.3.1 — 2018-02-09
- 1.3.0 — 2018-02-09
- 1.2.3 — 2018-02-01
- 1.2.2 — 2018-01-31
- 1.2.1 — 2018-01-31
- 1.2.0 — 2018-01-31
- 1.1.1 — 2017-07-09
- 1.1.0 — 2017-06-06
- 1.0.0 — 2017-06-06

## README

# sync-rpc

Run asynchronous commands synchronously by putting them in a separate process

[![Build Status](https://img.shields.io/travis/ForbesLindesay/sync-rpc/master.svg)](https://travis-ci.org/ForbesLindesay/sync-rpc)
[![Dependency Status](https://img.shields.io/david/ForbesLindesay/sync-rpc/master.svg)](http://david-dm.org/ForbesLindesay/sync-rpc)
[![NPM version](https://img.shields.io/npm/v/sync-rpc.svg)](https://www.npmjs.org/package/sync-rpc)

## Installation

```
npm install sync-rpc --save
```

## Usage

### worker.js

```js
function init(connection) {
  // you can setup any connections you need here
  return function (message) {
    // Note how even though we return a promise, the resulting rpc client will be synchronous
    return Promise.resolve('sent ' + message + ' to ' + connection);
  }
}
module.exports = init;
```

```js
const assert = require('assert');
const rpc = require('sync-rpc');

const client = rpc(__dirname + '/../test-worker.js', 'My Server');

const result = client('My Message');

assert(result === 'sent My Message to My Server');
```

## License

MIT

---
_Source: https://npm.io/package/sync-rpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
