apr-awaitify
v3.0.3
Published
Transform a callback-based function into a promise-based one.
Downloads
23
Maintainers
Readme
awaitify
Transform a callback-based function into a promise-based one.
Parameters
function
Function
Examples
import { readFile as readFileCb } from 'fs';
import awaitify from 'apr-awaitify';
import path from 'path';
const readFile = awaitify(readFileCb);
const pkgPath = path.join(__dirname, './package.json');
const pkg = await readFile(pkgPath, 'utf-8');
Returns Function