NonBlocking ~Nodejs~ File System
When running an application in NodeJS, it’s single threaded, and will only utilise a single core.
When performing cpu-intensive or a great number of tasks, you may see this impacting performance, and see runtime/respond-time increase.
If your NodeJS Application has 100% cpu-usage and is taking a long time to complete or slow to respond, this can be improved by dividing the work to be done, and spreading it over multiple processes.
Traditional (Many tasks to a single node process)
Distributed (Many tasks to distributed to multiple worker processes)
nbfs creates and manage multiples processes which communicate between themself. This approach helps a lot for a non-blocking nodejs architechure.
Even if you use FS native stream API or based on async ways to this job, will always run on the nodejs main thread (in idle status or not).
For install nbfs, just run in your terminal:
npm i nbfs -S
const read =const stream = // absolute pathstreamstreamstream
const write =const stream = // absolute pathstreamstreamstream
fs.readFile x 10,738 ops/sec ±2.46%nbfs.read x 7,701 ops/sec ±2.74%fs.readFileSync x 49,473 ops/sec ±1.75%exec cat x 148 ops/sec ±1.57%