pifi
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

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.

Package Sidebar

Install

npm i pifi

Weekly Downloads

22

Version

1.1.1

License

MIT

Unpacked Size

1.69 kB

Total Files

4

Last publish

Collaborators

  • linusu