/promised

A utility to convert callbacks to promises.

Primary LanguageTypeScriptMIT LicenseMIT

@znck/promised Build Status Coverage Status

A utility to make any callback based module/object to return promises.

Installation

npm add @znck/promised # or `pnpm add @znck/promised` or `yarn add @znck/promised`

Usage

import promised from '@znck/promised'
import * as fs from 'fs'

// ...
if (await promised(fs).exists('example.txt')) {
  const contents = await promised(fs).readFile('example.txt')
  // ...
}