Gathering detailed insights and metrics for @medipass/pify
Gathering detailed insights and metrics for @medipass/pify
Gathering detailed insights and metrics for @medipass/pify
Gathering detailed insights and metrics for @medipass/pify
npm install @medipass/pify
Typescript
Module System
Min. Node Version
Node Version
NPM Version
71.8
Supply Chain
98.8
Quality
82.6
Maintenance
100
Vulnerability
100
License
JavaScript (71.47%)
TypeScript (28.53%)
Total Downloads
228,952
Last Day
31
Last Week
1,717
Last Month
6,752
Last Year
61,802
MIT License
1,506 Stars
69 Commits
68 Forks
15 Watchers
1 Branches
15 Contributors
Updated on Jun 30, 2025
Minified
Minified + Gzipped
Latest Version
3.0.0-3
Package Id
@medipass/pify@3.0.0-3
Size
3.14 kB
NPM Version
5.4.2
Node Version
8.7.0
Published on
Nov 15, 2017
Cumulative downloads
Total Downloads
Last Day
-58.1%
31
Compared to previous day
Last Week
56.7%
1,717
Compared to previous week
Last Month
27.1%
6,752
Compared to previous month
Last Year
60%
61,802
Compared to previous year
Promisify a callback-style function
$ npm install --save pify
1const fs = require('fs'); 2const pify = require('pify'); 3 4// Promisify a single function 5pify(fs.readFile)('package.json', 'utf8').then(data => { 6 console.log(JSON.parse(data).name); 7 //=> 'pify' 8}); 9 10// Promisify all methods in a module 11pify(fs).readFile('package.json', 'utf8').then(data => { 12 console.log(JSON.parse(data).name); 13 //=> 'pify' 14});
Returns a Promise
wrapped version of the supplied function or module.
Type: Function
Object
Callback-style function or module whose methods you want to promisify.
Type: boolean
Default: false
By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like request
that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error.
1const request = require('request'); 2const pify = require('pify'); 3 4pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { 5 const [httpResponse, body] = result; 6});
Type: string[]
RegExp[]
Methods in a module to promisify. Remaining methods will be left untouched.
Type: string[]
RegExp[]
Default: [/.+(Sync|Stream)$/]
Methods in a module not to promisify. Methods with names ending with 'Sync'
are excluded by default.
Type: boolean
Default: false
If given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module.
1const pify = require('pify'); 2 3function fn() { 4 return true; 5} 6 7fn.method = (data, callback) => { 8 setImmediate(() => { 9 callback(null, data); 10 }); 11}; 12 13// Promisify methods but not `fn()` 14const promiseFn = pify(fn, {excludeMain: true}); 15 16if (promiseFn()) { 17 promiseFn.method('hi').then(data => { 18 console.log(data); 19 }); 20}
Type: boolean
Default: true
Whether the callback has an error as the first argument. You'll want to set this to false
if you're dealing with an API that doesn't have an error as the first argument, like fs.exists()
, some browser APIs, Chrome Extension APIs, etc.
Type: Function
Custom promise module to use instead of the native one.
Check out pinkie-promise
if you need a tiny promise polyfill.
MIT © Sindre Sorhus
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 10/30 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More