Warz Warz - 1 month ago 3x
Node.js Question

Reading files from a directory inside a meteor app

How can i read the public directory in a meteor application inside my /server path.

I tried using the native

package but i keep getting a file/directory not found error.

var fs = Npm.require('fs');
var files = fs.readdirSync('/public/soundfiles/');

Has anyone used the filesystem package to read static files inside a meteor application?


Access files without the "/public" part. In a running Meteor app, the public directory becomes your root, and everything that is located at /public/whatever can be accessed at /whatever.

Additionally, if you're playing around with files, you might find these useful: