The Node.js Update #41; 12 October, 2018
Below you can find RisingStack’s collection of the most important Node.js updates, tutorials & announcements from this week.
Node.js v10.12.0 (Current) Released. Changes:
- assert: The diff output is now a tiny bit improved by sorting object properties when inspecting the values that are compared with each other.
- cli:
- The options parser now normalizes
_
to-
in all multi-word command-line flags, e.g.--no_warnings
has the same effect as--no-warnings
. - Added bash completion for the
node
binary. To generate a bash completion script, runnode --completion-bash
. The output can be saved to a file which can be sourced to enable completion. - crypto:
- Added support for PEM-level encryption.
- Added an API asymmetric key pair generation. The new methods
crypto.generateKeyPair
andcrypto.generateKeyPairSync
can be used to generate public and private key pairs. The API supports RSA, DSA and EC and a variety of key encodings (both PEM and DER). - fs: Added a
recursive
option tofs.mkdir
andfs.mkdirSync
. If this option is set to true, non-existing parent folders will be automatically created. - http2:
- Added a
'ping'
event toHttp2Session
that is emitted whenever a non-ackPING
is received. - Added support for the
ORIGIN
frame. - Updated nghttp2 to 1.34.0. This adds RFC 8441 extended connect protocol support to allow use of WebSockets over HTTP/2.
- module: Added
module.createRequireFromPath(filename)
. This new method can be used to create a custom require function that will resolve modules relative to the filename path. - process: Added a
'multipleResolves'
process event that is emitted whenever aPromise
is attempted to be resolved multiple times, e.g. if theresolve
andreject
functions are both called in aPromise
executor. - url: Added
url.fileURLToPath(url)
andrl.pathToFileURL(path)
. These methods can be used to correctly convert between file: URLs and absolute paths. - util:
- Added the
sorted
option toutil.inspect()
. If set totrue
, all properties of an object and Set and Map entries will be sorted in the returned string. If set to a function, it is used as a compare function. - The
util.inspect.custom
symbol is now defined in the global symbol registry asSymbol.for('nodejs.util.inspect.custom')
. - Added support for
BigInt
numbers inutil.format()
. - V8 API: A number of V8 C++ APIs have been marked as deprecated since they have been removed in the upstream repository. Replacement APIs are added where necessary.
- Windows: The Windows msi installer now provides an option to automatically install the tools required to build native modules.
- Workers:
- Debugging support for Workers using the DevTools protocol has been implemented.
- The public
inspector
module is now enabled in Workers.
Node.js Security Handbook by Sqreen
Improve the security of your Node.js app with the Node.js Security Handbook made for developers.
Common Node8 mistakes in Lambda
That’s it, 5 common mistakes to avoid when working with Node.js 8.10 in Lambda. Including:
- Still using callbacks
- Not using promisfy
- Too sequential
- async/await inside forEach()
- Not using AWSSDK’s .promise()
Using Node.js to Read Really, Really Large Datasets & Files (Pt 1)
“In the end, Node.js’s pure file and big data handling functions fell a little short of what I needed, but with just one extra NPM package, EventStream, I was able to parse through a massive dataset without crashing the Node server.”
JWT authentication: When and how to use it
Learn when JWT when is best used, when it’s best to use something else, and how to prevent the most basic security issues.
—
For more Node.js content, follow us on Twitter @RisingStack.
In case you need guidance with Docker, Kubernetes, Microservices or Node.js, feel free to ping us at info@risingstack.com!
Originally published at community.risingstack.com on October 12, 2018.