1.1.1 • Published 6 years ago

pifi v1.1.1

Weekly downloads
62
License
MIT
Repository
github
Last release
6 years ago

pifi

Immediately invoked pify

Installation

npm install --save pifi

Usage

const pifi = require('pifi')
const fs = require('fs')

async function main () {
  console.log('Reading readme.md in 5 seconds')
  await pifi(cb => setTimeout(cb, 5000))

  console.log('Readind readme.md now')
  const content = await pifi(cb => fs.readFile('readme.md', cb))

  console.log('readme.md contains:', content)
}

API

pifi(fn[, promiseModule]) => Promise

Immediately invoke fn with a node-style callback, and return a promise that settles when the callback is called.