workerd icon indicating copy to clipboard operation
workerd copied to clipboard

Implement node:fs stubs

Open jasnell opened this issue 1 year ago • 2 comments

This just stubs out the node:fs module with implementations that throw. The intent here is to allow imports/requires to work without actually implementing the fs module.

Goal: Node.js compatibility, Frameworks

jasnell avatar Mar 12 '24 02:03 jasnell

Nice! 🙂 Would it be possible to stub out require("node:fs").promises and require("node:fs/promises") too? We currently stub these out (and a few other modules: https://github.com/cloudflare/workers-sdk/tree/main/packages/vitest-pool-workers/src/worker/lib/node) for the Vitest integration, and it would be nice if we didn't have to.

mrbbot avatar Mar 14 '24 00:03 mrbbot

Not sure if we're going to go forward with this or not. There's more to figure out. But if we do move forward with this approach, the idea is to have throwing stubs for all Node.js APIs we don't implement. Stay tuned.

jasnell avatar Mar 14 '24 01:03 jasnell

We've decided not to go this direction, thankfully :-)

jasnell avatar Apr 30 '24 18:04 jasnell