{"id":19560633,"url":"https://github.com/zoubin/node-promisify","last_synced_at":"2026-05-17T14:33:33.349Z","repository":{"id":32568869,"uuid":"36151678","full_name":"zoubin/node-promisify","owner":"zoubin","description":"convert callback function to node native promise","archived":false,"fork":false,"pushed_at":"2015-12-09T17:01:06.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-29T10:58:10.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zoubin.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-24T02:13:01.000Z","updated_at":"2015-05-24T04:42:28.000Z","dependencies_parsed_at":"2022-09-07T23:02:25.590Z","dependency_job_id":null,"html_url":"https://github.com/zoubin/node-promisify","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"3d8144b2638350fac1be416725e7006647f3e743"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/zoubin/node-promisify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fnode-promisify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fnode-promisify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fnode-promisify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fnode-promisify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoubin","download_url":"https://codeload.github.com/zoubin/node-promisify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fnode-promisify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33142179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T05:08:20.756Z","updated_at":"2026-05-17T14:33:28.340Z","avatar_url":"https://github.com/zoubin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-promisify\n[![version](https://img.shields.io/npm/v/node-promisify.svg)](https://www.npmjs.org/package/node-promisify)\n[![status](https://travis-ci.org/zoubin/node-promisify.svg?branch=master)](https://travis-ci.org/zoubin/node-promisify)\n[![dependencies](https://david-dm.org/zoubin/node-promisify.svg)](https://david-dm.org/zoubin/node-promisify)\n[![devDependencies](https://david-dm.org/zoubin/node-promisify/dev-status.svg)](https://david-dm.org/zoubin/node-promisify#info=devDependencies)\n\nConvert a callback-based api to one that returns a promise.\n\n**NOTE**:\n* Own properties are preserved. But other inherited properties such as `name`, `length`, `toString`, do not preserve.\n* Custom promise can be used instead of the native. But no polyfill is applied when your node version does not support promise.\n* Multiple values can be resolved when the `argc` option is specified.\n\n\n## Example\n\n```javascript\nvar promisify = require('../')\n\nfunction async(a, b, c, d, cb) {\n  process.nextTick(function () {\n    cb(null, a + b, a + b + c, a + b + c + d)\n  })\n}\n\nasync.sync = function (a, b) {\n  return a + b\n}\n\nvar promisified = promisify(async)\n\nconsole.log('Sync sum:', promisified.sync(1, 2))\npromisified(1, 2, 3, 4)\n  .then(function (sum) {\n    console.log('Async sum:', sum)\n  })\n\npromisify(async, 2)(1, 2, 3, 4)\n  .then(function (sums) {\n    console.log('Two sums:', sums)\n  })\n\npromisify(async, -1)(1, 2, 3, 4)\n  .then(function (sums) {\n    console.log('All sums:', sums)\n  })\n\n```\n\noutput:\n\n```\n⌘ node example/sums.js\nSync sum: 3\nAsync sum: 3\nTwo sums: [ 3, 6 ]\nAll sums: [ 3, 6, 10 ]\n\n```\n\n## pfn = promisify(fn, opts)\nReturn a new function which returns a promise.\n\nSugar: `pfn = promisify(fn, argc)`, `pfn = promisify(fn, promise)`\n\n### fn\nThe async function to be promisified.\n\nType: `Function`\n\nSignature: `fn(arg1, arg2, ..., done)`\n\n### opts\n\n#### promise\nSpecify a custom promise constructor.\n\nType: `Function`\n\n#### argc\nSpecify the number of values to be resolved.\n\nType: `Number`\n\nDefault: `null`\n\nWhen specified, the returned promise always resolve to an array.\nIf not specified, only the first value is resolved.\nTo resolve all possible values, specify a negative `argc`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fnode-promisify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoubin%2Fnode-promisify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fnode-promisify/lists"}