# @zingle/sync

> synchronization primitive to bridge CPS and async functions

Latest version **1.0.0** (published 2019-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zingle/sync
pnpm add @zingle/sync
yarn add @zingle/sync
bun add @zingle/sync
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-01-09 |
| First published | 2019-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Richard Remer |
| Maintainers | rremer |

## Links

- npm: https://www.npmjs.com/package/@zingle/sync
- Repository: https://github.com/Zingle/sync.js
- Homepage: https://github.com/Zingle/sync.js#readme
- Issues: https://github.com/Zingle/sync.js/issues
- npm.io page: https://npm.io/package/@zingle/sync

## Recent versions

- 1.0.0 (latest) — 2019-01-09
- 0.0.2 — 2019-01-09
- 0.0.1 — 2019-01-08

## README

Sync Function
=============
The `sync` function can be used to bridge async functions with traditional
continuation-passing style (CPS) functions.  Use the `sync` function to create
a callback with an associated `Promise` which can be used as a deferred result
for the callback.

Example
-------
```js
const fs = require("fs");
const sync = require("sync");

async function asyncReadFile(file) {
    const done = sync();        // create synchronization primitive
    fs.readFile(file, done);    // pass primitive as CPS callback
    return done.promise;        // return resulting promise
}
```

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