Closed
Description
Since node 8 and the introduction of util.promisify()
many internal node modules have started using these two Symbol
s 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)
?