util: add util.callbackify()
This is a first draft of an implementation of util.callbackify(function)
.
There is at least one issue that need ironing out: if and how to project the return value into multiple args...
Implementation inspired by @addaleax's #12442 Background discussion at: https://github.com/nodejs/CTC/issues/109
Open discussion
Should we allow customization of the wrapping?
- specifying a transform for the
awaitable
before the connection to the callback - projection of the returned value
- tiying in the callback into the promise's life-cycle
Original commit descriptions
util.callbackify(function)
for creating callback style functions
Add from functions returning a Promise
/awaitable
Fixes: https://github.com/nodejs/CTC/issues/109
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
util