M Barrettara
M Barrettara

Reputation: 103

Access node.js File System module in Meteor

I'm creating a web app that will edit some config files stored on a user's HD, and decided to give Meteor a shot.

I'd like to use Node.js's File System module to handle to I/O of the config files, but I haven't been able to figure out how to include the module. After some searching, I found the following code here on StackOverlow, which is supposed to allow me to require the module:

var require = __meteor_bootstrap__.require;
var fs = require('fs');

However, even with this placed inside of the if(server) portion of my code, my application is still throwing an error and telling me that 'fs' is undefined.

Has anyone else encountered this issue?

Upvotes: 9

Views: 5682

Answers (1)

Tarang
Tarang

Reputation: 75975

From 0.6.0 you need to use Npm.require

var fs = Npm.require('fs');

Upvotes: 18

Related Questions