Fs.realpath is undefined in the browser

Hi,

I tried using a package that is supposed to be working in the browser, however, I get the following error:

Uncaught TypeError: Cannot read property 'native' of undefined

which is happening in this piece of code:

if (typeof fs.realpath.native === 'function') {
  ...
}

I presume fs.realpath should be mocked somehow by meteor-node-stubs (?)

METEOR@1.12

I’ve created an issue in meteor-node-stubs, but maybe I just don’t understand something.

The package I’m trying to use: https://www.npmjs.com/package/ipfs-http-client

Thank you!

Hi,

fs is node bound so it is unlikely that it’s available on the client.

Hi,

I think meteor-node-stubs should provide stub implementation of fs on the client. Shouldn’t it?

It’s not the issue, browser wont allow access to filesystem because it’s a security threat.

Plus if you look in : https://github.com/meteor/node-stubs/blob/master/map.json you’ll see that fs is set to null.

Of course they won’t (although there is an experimental feauture). I was just hoping that meteor-node-stubs provides some dummy implementation but apparently it’s not.

Thanks for help! :slight_smile: