Best bet is to use the Node fs package and rely on the deno/bun compatibility layer.
More generally, Deno pushes for Web Platform APIs, and as more are proposed and implemented the runtime-specific APIs will become fewer and fewer.
[0]: https://developer.mozilla.org/en-US/docs/Web/API/Request
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Response
As for deno, I think if you publish ESM you’re mostly covered since deno can install from the npm registry.
My overall question is that I suspect there's a much better way of detecting and using the different backends, and I'm wondering what techniques are out there.
[0]: https://github.com/waygate-io/fs-js