https://github.com/junosuarez/pr
node builtins wrapped for promises
https://github.com/junosuarez/pr
Last synced: 5 months ago
JSON representation
node builtins wrapped for promises
- Host: GitHub
- URL: https://github.com/junosuarez/pr
- Owner: junosuarez
- Created: 2013-03-31T23:05:39.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-06-10T17:33:19.000Z (about 11 years ago)
- Last Synced: 2025-10-24T20:11:40.647Z (9 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pr
node builtins wrapped for promises
all of node's builtin apis as Promises/A+ - returning functions. Use the core module APIs you know without the impedence mismatch of adapting them to promises yourself.
[](https://github.com/feross/standard)
## installation
$ npm install pr
## usage
require any builtin module with `pr/` before it
## example
var fs = require('pr/fs')
fs.readdir(__dirname).then(function (files) {
console.log(__dirname + ':\n' + files.join('\n'))
})
## modules included
Methods taking one-time callbacks in the following module are wrapped with promise-returning versions:
- [fs](http://nodejs.org/api/fs.html)
- [child_process](http://nodejs.org/api/child_process.html)
- [crypto](http://nodejs.org/api/crypto.html)
- [dns](http://nodejs.org/api/dns.html)
- [zlib](http://nodejs.org/api/zlib.html)
Additionally, all base modules are available by `require('pr/name')` for convenience.
Functions which are documented as taking a callback, but which actually use the callback as an event listener rather than as a continuation, are not supported.
## not currently implemented
`(http|https).request` and `.get` both take callbacks but also have return values of streams. These will be supported in a future release of `pr`, and the returned object will support both the stream and promise interface.
`readline`'s `Interface#question` is not currently implemented.
We're interested in supporting the entire api! Please open a pull request to contribute.
## **api current as of node 0.8.x**
## contributors
jden
## license
Public Domain.
To the extent possible under law, Jason Denizac has waived all copyright and related or neighboring rights to pr. This work is published from: United States.