Node.js provides built-in API for on-disk caching

Node.js 22.8.0, the newest launch of the event-driven JavaScript runtime, provides a JavaScript API to allow on-disk caching of all modules loaded after the API is named, presenting a caching possibility for code.

The API is named module.allow.CompileCache(). It overrides the NODE_COMPILE_CACHE atmosphere variable, which solely finish customers may use to allow on-disk caching. The brand new API lets instrument and library authors handle the caching of their very own code. The answer is a built-in various to v8-compile-cache packages, providing higher efficiency and help for ESM (ECMAScript Modules).

Launched on September 3, Node 22.8.0 could be downloaded from Nodejs.org. It’s categorised as a present launch slightly than an LTS (long-term help) launch. With this replace, Node now helps requiring code protection to fulfill a selected threshold earlier than a course of efficiently exits. Builders who wish to use this functionality should set the –experimental-test-coverage flag. Thresholds could be set for forms of protection together with department, perform, and line coverages. Additionally in model 22.8.0, a taste of vm.createContext() has been added to create a context with out contextifying its world object when vm.constants.DONT_CONTEXTIFY is used. That is appropriate when customers wish to freeze the context or velocity up world entry if they don’t want the interceptor habits.

Leave a Reply

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