Node.js introduces built-in API for on-disk caching in 80 characters

SeniorTechInfo
2 Min Read

Welcome to the Latest Node.js 22.8.0 Release!

If you’re a fan of Node.js, you’ll be thrilled to hear about the newest release – Node.js 22.8.0. This update introduces a game-changing JavaScript API that allows for on-disk caching of all modules loaded after the API is called, providing a caching option for your code.

The API, named module.enable.CompileCache(), serves as an enhancement to the existing NODE_COMPILE_CACHE environment variable. Instead of solely relying on end users to enable on-disk caching, this new API empowers tool and library authors to manage the caching of their own code. This built-in solution offers better performance and ESM (ECMAScript Modules) support, surpassing the need for external packages like v8-compile-cache.

Released on September 3, Node.js 22.8.0 can be easily downloaded from Nodejs.org. While it’s considered a current release and not an LTS (long-term support) release, it boasts exciting new features. Developers can now enforce specific code coverage thresholds for a process to exit successfully by utilizing the --experimental-test-coverage flag. This update also introduces a version of vm.createContext() that enables the creation of a context without contextifying its global object when vm.constants.DONT_CONTEXTIFY is employed. This option is ideal for scenarios where users want to freeze the context or enhance global access speed without needing interceptor behavior.

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *