Access node.js File System module in Meteor


Question

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?

1
9
5/3/2012 7:17:12 PM

From 0.6.0 you need to use Npm.require

var fs = Npm.require('fs');
18
4/7/2013 7:12:54 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon