Gathering detailed insights and metrics for es6-promisify
Gathering detailed insights and metrics for es6-promisify
Gathering detailed insights and metrics for es6-promisify
Gathering detailed insights and metrics for es6-promisify
npm install es6-promisify
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
523 Stars
108 Commits
32 Forks
8 Watching
5 Branches
7 Contributors
Updated on 24 Nov 2024
JavaScript (99.46%)
Shell (0.54%)
Cumulative downloads
Total Downloads
Last day
-0.4%
808,997
Compared to previous day
Last week
4.3%
4,523,654
Compared to previous week
Last month
18.1%
17,961,864
Compared to previous month
Last year
-26.7%
199,254,262
Compared to previous year
Converts callback-based functions to Promises, using a boilerplate callback function.
Install with npm
1npm install es6-promisify
1const {promisify} = require("es6-promisify"); 2 3// Convert the stat function 4const fs = require("fs"); 5const stat = promisify(fs.stat); 6 7// Now usable as a promise! 8try { 9 const stats = await stat("example.txt"); 10 console.log("Got stats", stats); 11} catch (err) { 12 console.error("Yikes!", err); 13}
1const {promisify} = require("es6-promisify"); 2 3// Create a promise-based version of send_command 4const redis = require("redis").createClient(6379, "localhost"); 5const client = promisify(redis.send_command.bind(redis)); 6 7// Send commands to redis and get a promise back 8try { 9 const pong = await client.ping(); 10 console.log("Got", pong); 11} catch (err) { 12 console.error("Unexpected error", err); 13} finally { 14 redis.quit(); 15}
1const {promisify} = require("es6-promisify"); 2 3function test(cb) { 4 return cb(undefined, 1, 2, 3); 5} 6 7// Create promise-based version of test 8test[promisify.argumentNames] = ["one", "two", "three"]; 9const multi = promisify(test); 10 11// Returns named arguments 12const result = await multi(); 13console.log(result); // {one: 1, two: 2, three: 3}
1const {promisify} = require("es6-promisify"); 2 3// Now uses Bluebird 4promisify.Promise = require("bluebird"); 5 6const test = promisify(cb => cb(undefined, "test")); 7const result = await test(); 8console.log(result); // "test", resolved using Bluebird
Test with tape
1$ npm test
Published under the MIT License.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
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
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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