Hacker News new | comments | ask | show | jobs | submit login
The Node.js Project Introduces Latest Release Line: Node.js 10.x (medium.com)
62 points by alvis 9 months ago | hide | past | web | favorite | 19 comments

Good to see that they are adding promisified versions of more core function like fs. It makes things even simpler for new users especially with async/await support.

I really wish they would add a promise based version of the http/https client. The current version uses events rather than the standard callback signature so it can't be automatically converted using util.promisify().

They don't have to modify the existing low-level http client, just add a new API. They could even use the existing fetch() API that users are already familiar with on the client side.

It really should be dead simple for a new user to make an http call in Node without having to npm install a 3rd party library. I recently created an AWS Lambda function (directly via the console) and I just wanted to check to see what the outside world thought my IP was. In theory, with Node.js 8 It should only take a two liner like this:

  const response = await fetch('https://httpbin.org/ip');
  return response.json();
Instead I had to wrap it in a promise myself using untested code that I cribbed from StackOverflow[1].


There's a module named `node-fetch` that mirrors the client Fetch API. Might make for a better solution. (but I agree it would be great for it to be built in)

I would not recommend `node-fetch', it's pretty crappy in term of performance if you are hitting a same host and expect some kind of keep-alive / pipelining. Switching to `make-fetch-happen' fixed all my issues.

Also if you're not intentionally looking to use a low level API, axios is much better.

Yea, built-in is what I was really going for. It would be great if new users could easily do a one-liner fetch without having to:

a) Research and compare the various npm modules available and then install one (which isn't even possible via the Lambda console)


b) Figure out how to wrap an event based function in a promise (or search stack overflow and copy one)

Something like this should be super easy to do from the cli/REPL or web console without dependencies. You should only have to install a module when you want more advanced features.

Builtin fetch was proposed recently, here is the issue: https://github.com/nodejs/node/issues/19393

I'm quite disappointed by most of these fetch API's.

They can do the easy tasks very nicely.

But once you need to do a bit more, you need to use another package.

request [0] has done everything I ever wanted it to do and request-promise-native [1] makes it async/friendly.

[0] https://www.npmjs.com/package/request

[1] https://www.npmjs.com/package/request-promise-native

With a little twist, you could make it asynchronously iterable, i.e. if you wanted to iterate over the 'data' chunks/events as they arrive:


Use one of the fetch modules from npm.

Having async_hooks in an LTS release is going to be awesome. The v10.x docs aren't live yet but I'm assuming it'd be similar to the v9.x functionality[1]. There's a lot of interesting use cases for it and I think it's the long term replacement for one of the major use cases for domains[2], namely continuation local storage. Domains have been available but deprecated since v0.10 so great to see a path forward to finally switch off them.

[1]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.htm...

[2]: https://nodejs.org/dist/latest-v9.x/docs/api/domain.html

Agreed. It’s the feature I’m most excited about.

Continuation local storage is a bit fuckie at the oddest times, but has really been a game changer for logging purposes and contextualizing errors within requests better.

Given that meaningful stack traces and proper context are by far the weakest part of asynchronous programming, I have hoped to see development on this front above any other aspect of the language.

Are domains removed from this release?

I haven't see the latest docs yet but I don't think so. They're still there as of the latest v9.x release so I'd imagine there still in v10.x as well.

That's what I thought and good news.

We use domains as continuous local storage. This gives us enough time to have a stress-free migration to async hooks.

Yep it's still there. Looks like we're good until at least the end of that LTS release, Nov 2020!

No mention of ECMAScript Modules?

There was no big change on the ESM side. They are still experimental and require the `.mjs` extension. The only change around modules that I am aware of is the update of the V8 engine. It adds support for `import.meta`.

There are still ongoing discussions around Node's ESM support, you can follow the modules repo [0].

[0]: https://github.com/nodejs/modules

OpenSSL 1.1 finally arrives at Node 10.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact