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 'fs' 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:

This is no longer true. For Meteor 0.8, the folder "../client/app" is public. Thus, use fs.readdirSync('../client/app') to get files and folders in public.

Source: personal experience and http://stackoverflow.com/a/18405793

For meteor 1.0.2 public is /web.browser/app/ Checked by entering .meteor dir Total path in linux /home/user/your_app_name/.meteor/local/build/programs/web.browser/app/ And to get to root is `process.env.PWD or process.cwd(). Im not sure if its work deployed.

_meteor_bootstrap_.serverDir +'/assets/app'

This is path to private folder.