Meteor: "ReferenceError: fs not defined"

Losing my mind with this ...

Getting "fs not defined" on meteor when trying to read a file:

var data = fs.readFileSync(filepathHidden);

      

I have this package: cfs:filesystem 0.1.2

onMeteor 1.1.0.2

The funny thing is that if I write in the fs meteor shell it prints the object and seems to have a lot of functionality, etc. But the point here is that after writing fs in the meteor shell, my code starts working !? And if I close the meteor server and then start it again, my server code jerks until I run fs in the meteor shell ...

Can someone please explain what's going on in this case? And how do I achieve the same in my code.

+3


source to share


1 answer


You just need to download it via npm

. In a meteor that looks like this:



var fs = Npm.require('fs');
var data = fs.readFileSync(filepathHidden);

      

+5


source







All Articles