![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
memory-mapped-files
Advanced tools
Loading and mapping files into the memory using native code, allowing workers to access the files without redundant reads from disk.
Native
.node
addon for node.js written in C#.
Memory-mapped files offer a significant performance benefit over standard file access. It reduces the number of times the application must access the disk (which is slow compared to memory). In case you use thread workers, you can share the memory-mapped files between them, so you will also reduce the number of redundant file reads.
Native file reading is much faster than reading from a node.js. Memory-mapped files are intended mainly for workers so it creates TCP server that holds the files; Workers transfer the files over the network so it slows it down a little, but it is still much faster than reading from a node.js.
You can start the cache server in the background using the startCacheServer
function.
import { startCacheServer } from "memory-mapped-files";
startCacheServer("./working/directory");
You can also stop the cache server using the stopCacheServer
function.
stopCacheServer();
Second parameter of the startCacheServer
is an array of glob patterns that specify which files from the working directory should be cached.
import { startCacheServer } from "memory-mapped-files";
startCacheServer("./working/directory", ["**/*.ts"]);
Default value glob is **/*
, so all the files from working directory are cached.
Memory-mapped files does not track changes in the working directory. File deletions or changes are not reflected in the cache. You can change the files using the client (not fully implemented yet).
You can read the file using the getFile
and getFileAsync
methods on the Client
.
File paths should be relative from the working directory.
Each client creates a new TCP connection to the cache server, so it is recommended to create a single client and reuse it. One client should not do parallel requests; multiple clients can.
import { createClient } from "memory-mapped-files";
const client = createClient();
// Sync read
client.getFile("some-dir/index.ts");
// Async read
await client.getFileAsync("some-dir/index.ts");
client.dispose();
You should call the dispose method when you are done with the client.
You can do it manually or use the new using
keyword from TS 5.2, see the release note.
import { createClient } from "memory-mapped-files";
const client = createClient();
client.getFile("some-dir/index.ts");
client.dispose();
or
import { createClient } from "memory-mapped-files";
using client = createClient();
client.getFile("some-dir/index.ts");
FAQs
Loading and mapping files into the memory using native code, allowing workers to access the files without redundant reads from disk.
The npm package memory-mapped-files receives a total of 2 weekly downloads. As such, memory-mapped-files popularity was classified as not popular.
We found that memory-mapped-files demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.