Top
Best
New

Posted by voctor 7 hours ago

Node.js needs a virtual file system(blog.platformatic.dev)
143 points | 126 commentspage 2
syrusakbary 3 hours ago|
[flagged]
szmarczak 1 hour ago|
HN comments isn't a place to advertise your product.
szszrk 1 hour ago||
I am not so sure about that. I recall multiple posts that start with most upvoted comments from founders...

Wonder what Dang says about that.

mohsen1 5 hours ago||
Yarn, pnpm, webpack all have solutions for this. Great to see this becoming a standard. I have a project that is severely handicapped due to FS. Running 13k tests takes 40 minutes where a virtual file system that Node would just work with it would cut the run time to 3 minutes. I experimented with some hacks and decided to stay with slow but native FS solution.

What I really want is a way of swapping FS with VFS in a Node.js program harness. Something like

     node --use-vfs --vfs-cache=BIG_JSON_FILE 
So basically Node never touches the disk and load everything from the memory
Normal_gaussian 4 hours ago|
The way to do this today is to do it outside of node. Using an overlay fs with the overlay being a ramfs. You can even chroot into it if you can't scope the paths you need to be just downstream from some directory. Or, just use docker.
mohsen1 4 hours ago||
making that work cross platform is pure pain
Normal_gaussian 4 hours ago|||
yes and no. Waiting 40mins for every test run is pure pain, platform specific ramfs type mounting is quite scriptable. Yes some devs might need to install a dependency, but its not a complex script.
skydhash 1 hour ago|||
What are the other OS? There's a bunch of solutions described on Wikipedia

https://en.wikipedia.org/wiki/List_of_RAM_drive_software

sidewndr46 2 hours ago||
Don't all projects eventually grow to encompass service discovery?
Normal_gaussian 5 hours ago||
yarn pnp is currently broken on Node v25.7+;

- https://github.com/yarnpkg/berry/issues/7065

- https://github.com/nodejs/node/issues/62012

This is because yarn patches fs in order to introduce virtual file path resolution of modules in the yarn cache (which are zips), which is quite brittle and was broken by a seemingly unrelated change in 25.7.

The discussion in issue 62012 is notable - it was suggested yarn just wait for vfs to land. This is interesting to me in two ways: firstly, the node team seems quite happy for non-trivial amounts of the ecosystem to just be broken, and suggests relying on what I'm assuming will be an experimental API when it does land; secondly, it implies a lot of confidence that this feature will land before LTS.

chrisweekly 4 hours ago|
Strong rec to choose PNPM over yarn. I just posted this in a peer comment: https://news.ycombinator.com/item?id=47415173

Not spamming, not affiliated, just trying to help others avoid so much needless suffering.

Normal_gaussian 4 hours ago|||
This is quite spammy; you could mitigate it by explaining what you think the "needless suffering" is. Having been using npm, pnpm, and yarn for many years the only benefit I find with pnpm is a little bit of speed when using the cli, but not enough that I notice; I've outlined the major yarn benefit to me 'in a peer comment' (which I didn't realise was you when I answered) https://news.ycombinator.com/item?id=47415660

I expect yarn to have a real competitor sooner rather than later that will replace it; and I do wonder if it is this vfs module that will enable it.

zadikian 4 hours ago|||
I just use npm because I like to stay as vanilla as possible. Glad that alternatives exist though.
Normal_gaussian 3 hours ago||
This can't be overstated. The main benefit with yarn berry (v4+) is being able to commit the dependencies to the repo - I have yarn based tools that I wrote years ago that just work wheras I frequently find npm and python tools are broken due to version changes. However this benefit comes at a setup cost and a lot more on disk complexity - one off tools are just npm and done.
notnullorvoid 5 hours ago||
I could see something like this being useful if it could be passed to workers to replace any fs access inside the worker.
gwbas1c 3 hours ago||
Can you dynamically load code via eval?

(I know, I know, it's ugly and has its own set of problems)

ozlikethewizard 5 hours ago||
I'm not convinced this needs to be in core Node, but being able to have serverless functions access a file system without providing storage would definitely have some use cases. Had some fun with video processing recently that this would be perfect for.
adzm 4 hours ago||
How does electron do this with its packaged files? I suppose it does not work with module resolution?
verdverm 2 hours ago|
Separate the valid critiques on other comments, Go's io.FS interface is really nice for making these sorts of things. Is there something like this in Node already? (with base implementations like host and in memory)
More comments...