Skip to content

Expose reference to the Symbol(customPromisifyArgs) #14007

Closed
@jcready

Description

@jcready

Since node 8 and the introduction of util.promisify() many internal node modules have started using these two Symbols to provide hints to util.promisify() as to how the function should be promisified. However, only Symbol(util.promisify.custom) is readily available:

const customPromisifySymbol = require('util').promisify.custom

The second one Symbol(customPromisifyArgs) is a bit more difficult to get a reference to, but it can be done:

const customArgsSymbol = Object.getOwnPropertySymbols(require('fs').read)
  .find((s) => String(s) === 'Symbol(customPromisifyArgs)')

Would it be possible to also expose a reference to the latter in a more convenient way, maybe as require('util').promisify.args? Is there a reason Symbol(customPromisifyArgs) isn't exposed the same way as Symbol(util.promisify.custom)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions