# pify **Repository Path**: mirrors_stephenplusplus/pify ## Basic Information - **Project Name**: pify - **Description**: Promisify a callback-style function - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-23 - **Last Updated**: 2026-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) > Promisify a callback-style function ## Install ``` $ npm install --save pify ``` ## Usage ```js var fs = require('fs'); var pify = require('pify'); pify(fs.readFile)('package.json', 'utf8').then(function (data) { console.log(JSON.parse(data).name); //=> 'pify' }); // Wrap entirel modules var promiseFs = pify.all(fs); promiseFs.readFile('package.json', 'utf8').then(function (data) { console.log(JSON.parse(data).name); //=> 'pify' }); ``` ## API ### pify(input, [promiseModule]) Returns a promise wrapped version of the supplied function. If the callback of the supplied function gets more than two arguments the result will be an array. #### input Type: `function` Callback-style function. ### pify.all(module, [promiseModule]) Returns a promise wrapped version of the module. #### module Type: `object` A module whose methods you want to transform into promises. #### promiseModule Type: `function` Custom promise module to use instead of the native one. Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. ## License MIT © [Sindre Sorhus](http://sindresorhus.com)