# promised-node

> Allow loading existing node modules with callbacks as promises modules.

Latest version **0.1.4** (published 2014-10-10) · 0 weekly downloads

## Install

```sh
npm install promised-node
pnpm add promised-node
yarn add promised-node
bun add promised-node
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2014-10-10 |
| First published | 2014-09-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | bmustiata |
| Keywords | node, promise, promises, promised-node, blinkts-lang, blinkts.net, blinkts |

## Links

- npm: https://www.npmjs.com/package/promised-node
- Repository: https://github.com/bmustiata/promised-node
- Homepage: https://github.com/bmustiata/promised-node/blob/master/README.md
- Issues: https://github.com/bmustiata/promised-node/issues
- npm.io page: https://npm.io/package/promised-node

## Dependencies (1)

- [blinkts-lang](https://npm.io/package/blinkts-lang.md) 0.1.7

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2014-10-10
- 0.1.3 — 2014-09-04
- 0.1.2 — 2014-09-04
- 0.1.1 — 2014-09-04
- 0.1.0 — 2014-09-04

## README

promised-node
=============

Allow loading existing node modules with callbacks as promises modules.

How it works is by scanning the module for functions that have the same name
also with a Sync suffix (e.g. readdir and readdirSync), and then replaces them
with a function that doesn't have the last callback parameter, but
instead returns a promise.

Promises are fully conformant to the APlus promises spec:
https://github.com/promises-aplus/promises-spec

Here is an example:

```javascript
var fs = require("promised-node").load("fs");

fs.readdir(".").then(function(files) {
    files.forEach(function(name) {
        console.log(name);
    });
});
```
If the callback method receives multiple arguments, they will be sent
into an Array into the fulfillment of the promise:

```javascript
var fs = require("promised-node").load("fs");

var fd;

fs.open("test.txt", "w").then(function(_fd) {         // open the file
    fd = _fd;
    return fs.write(fd, new Buffer("test"), 0, 4, 0); // write 4 bytes
}).then(function(data) {
    console.log("written: ", data);
    return fs.close(fd);                              // close the file
}).then(null, function(e) {
    console.log("Something terrible happened: ", e);
});
```

As you can notice, since now we're using promises, writing async code
becomes far simpler now.

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