News for hackers. Stuff that matters.
Re:Node v8.0.0 Released by flavio81 on Tuesday May 30, 2017 @03:42PM (#14447928)
As noted, this already was possible in Node 7.x. But to use it, you needed a function that returned a promise. And many functions do not, due to having been developed earlier. This is true even for libraries done in 2016. Even today many Node.js developers don't seem to use async/await. At least in my country... And thus they live in braces {} hell.

The improvement on the 8.0.0 version is that such an "oldie" function can be Promisified. A great improvement.

Re:Node v8.0.0 Released by floatboth on Tuesday May 30, 2017 @05:10PM (#14448575)
You could always promisify functions manually, or with this tiny package https://github.com/sindresorhus/pify but yeah it's nice to see that in the standard library.
Re:Node v8.0.0 Released by bfred_it on Tuesday May 30, 2017 @10:27PM (#14450069)
util.promisify is now in Node core as shown in the Original Comment
Re:Node v8.0.0 Released by simplify on Tuesday May 30, 2017 @03:50PM (#14448003)
By "oldie" function, do you mean functions that expect node-style callbacks?

  e.g. function myCallback (err, result) {...}
Re:Node v8.0.0 Released by styfle on Tuesday May 30, 2017 @03:58PM (#14448065)
Correct. Most node core APIs are written this way and now core ships an utility function[0] to wrap those functions in a promise.

[0]: https://medium.com/@styfle/promises-in-node-js-8-x-core-d6a8...

Re:Node v8.0.0 Released by mastax on Tuesday May 30, 2017 @05:39PM (#14448757)
It seems to me that Node should ship promisify-ed versions of all these functions (e.g. fs.readFileAsync). Over time they could replace the implementation with ones that use the OS Async APIs, though perhaps this step is unnecessary if you're already using an event loop underneath.
Re:Node v8.0.0 Released by lhnz on Tuesday May 30, 2017 @06:14PM (#14448982)
Until then you can use `mz` for a modernised API[0].

[0] https://github.com/normalize/mz

Re:Node v8.0.0 Released by NoInkling on Wednesday May 31, 2017 @02:21AM (#14450721)
I mean, they've been debating about how to add a promisified API for years (see for example https://github.com/nodejs/node/pull/5020) but nothing has come of it. util.promisify is a welcome addition, but very late for a first step.
Re:Node v8.0.0 Released by abalashov on Wednesday May 31, 2017 @08:28AM (#14451922)
How incredibly uncanny. Just yesterday morning, I posted this question!

https://stackoverflow.com/questions/44260289/using-native-es...