Even better: if you've updated your Node environment to one of the latest long-term-support (LTS) releases (8.x at the time of writing), then util.promisify is natively supported – you already have this tool.
@Almenon Node 7.x, along with all odd-numbered releases, are not LTS versions: their support ends as quickly as it comes. Node 8 is the current LTS Node version, so if you have things running 7, then they should already be upgraded to 8 because your support is already up.
The original blog post for the release of 7 states that support would likely end in June 2017; since it's not a LTS version, it isn't included on Node's release schedule / EOL list. For reference, you can see the full schedule by going to the nodejs.org homepage and clicking "Long term support (LTS) schedule".
@wosevision, ah, that's good news. Thanks for the tip. I have some work in AREPL I need to get done but I can probably get to this after that. I've earmarked the issue for v1.0.1 release :)
To be honest I'm probably not going to get to this anytime soon. I'd be happy to review a PR if someone submits it. Or if someone wants to donate to charity I can use that as motivation to get around to implementing this.
Activity
damianobarbati commented on Apr 26, 2017
any news on this?
extrabacon commented on Apr 27, 2017
Sorry, you will have to wrap the callbacks with a 3rd party library for now. PRs are welcome though.
See: http://bluebirdjs.com/docs/api/promisification.html
maziarz commented on Jan 16, 2018
This feature would be awesome, especially for users working in React, Vue, Angular etc. Any progress or where to start?
Almenon commented on Jan 17, 2018
@maziarz like extrabacon said, you can use bluebird to promisfy stuff.
A good example of this is python-bridge, a very similar project to this one.
Some relevant code from their index.js:
wosevision commented on May 1, 2018
Even better: if you've updated your Node environment to one of the latest long-term-support (LTS) releases (8.x at the time of writing), then util.promisify is natively supported – you already have this tool.
From 2ality.com:
Almenon commented on Aug 20, 2018
util.promisify sounds cool but we might want to continue supporting node v7 - anyone know when v7 will be deprecated?
It's also possible to create promises manually, but it takes a bit of boilerplate - see my new checkSyntaxCode I added in as an example:
wosevision commented on Aug 22, 2018
@Almenon Node 7.x, along with all odd-numbered releases, are not LTS versions: their support ends as quickly as it comes. Node 8 is the current LTS Node version, so if you have things running 7, then they should already be upgraded to 8 because your support is already up.
The original blog post for the release of 7 states that support would likely end in June 2017; since it's not a LTS version, it isn't included on Node's release schedule / EOL list. For reference, you can see the full schedule by going to the nodejs.org homepage and clicking "Long term support (LTS) schedule".
So in short: it is already deprecated.
Almenon commented on Aug 24, 2018
@wosevision, ah, that's good news. Thanks for the tip. I have some work in AREPL I need to get done but I can probably get to this after that. I've earmarked the issue for v1.0.1 release :)
jordond commented on Sep 3, 2018
Here's a wrapper I use, works well enough for me.
Almenon commented on Aug 24, 2019
To be honest I'm probably not going to get to this anytime soon. I'd be happy to review a PR if someone submits it. Or if someone wants to donate to charity I can use that as motivation to get around to implementing this.
nkhil commented on Feb 21, 2020
We had the same issue today, and ended up promisifying it like so:
AlexString commented on Apr 2, 2022
@nkhil implementation worked for me but I did something more like this in a Class:
Almenon commented on Feb 11, 2023
This is done w/ the latest version of python-shell (5.0.0).