node-promise-es6
An ES6 promise adapter for the Node.js API for use with ES7 async/await
Last updated 11 years ago by vinsonchuong .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install node-promise-es6 
SYNC missed versions from official npm registry.

node-promise-es6

Build Status

ES6 promise adapters for the Node.js API for use with ES7 async/await.

Installing

node-promise-es6 is available as an npm package.

Usage

Wrapped APIs

fs

import {fs} from 'node-promise-es6';

async function run() {
  console.log(await fs.readdir('.'));
}

child_process

import {childProcess} from 'node-promise-es6';

async function run() {
  const {stdout, stderr} = await childProcess.exec('ls .');
  console.log(stdout, stderr);
}

Utilities

promisify

import {promisify} from 'node-promise-es6';

function callbackFn(x, y, callback) {
  callback(null, x, y);
}

async function run() {
  const promiseFn = promisify(callbackFn, ['x', 'y']);
  const {x, y} = await promiseFn(1, 2);
  console.log(x === 1 && y === 2);
}

A helper for wrapping Node.js-style callback-taking functions (error object as first argument) in a Promise API.

Development

Getting Started

The application requires the following external dependencies:

  • Node.js

The rest of the dependencies are handled through:

npm install

Run tests with:

npm test

Current Tags

  • 0.3.2                                ...           latest (11 years ago)

13 Versions

  • 0.3.2                                ...           11 years ago
  • 0.3.1                                ...           11 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.3                                ...           11 years ago
  • 0.2.2                                ...           11 years ago
  • 0.2.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
  • 0.0.6                                ...           11 years ago
  • 0.0.5                                ...           11 years ago
  • 0.0.4                                ...           11 years ago
  • 0.0.3                                ...           11 years ago
  • 0.0.2                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Maintainers (1)
Downloads
Total 41
Today 0
This Week 0
This Month 15
Last Day 0
Last Week 1
Last Month 10
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE