I'm doing some file manipulation work with node.js and many of the packages that I use require a "path" to be sent so that they can open the file, do some work, and so on.
But I'm parsing millions of files and rather than actually store them on disk, I'd like to store them in memory. The contents of the files are all in my database and I'd hate to write them to disk, just to do my insanely awesome work on them.
So is such a thing possible?
They are absolutely NOT SAFE.
Storing your Node. js application's configuration data is quite simple - every object in JavaScript can be easily rendered as JSON, which in turn is just string data that can be sent or saved any way you'd like. The simplest way to do this involves the built-in JSON. parse() and JSON.
Memory Management in Node.Memory management provides ways to dynamically allocate memory chunks for programs when they request it, and free them when they are no longer needed – so that they can be reused. Application-level memory management can be manual or automatic.
It looks like it's possible look at this article how to do it creating writable memory stream
You can use memfs
, which is an in-memory filesystem for Node.js.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With