Can't access file in private

I’m using the netanelgilad:excel package to import xls files into Mongo. I have a spreadsheet located in /private/datafiles/default_list.xls. I can’t seem to be able to access this file.

Server side:

    var fileName = 'datafiles/default_list.xls';
    var excel = new Excel('xlsx');
    var fs = Npm.require('fs');
    var path = Npm.require('path');
    var basepath = path.resolve('.').split('.meteor')[0];
    var workbook = excel.readFile(fileName);

results in error:

Exception while invoking method 'adminSLLoad' Error: ENOENT, no such file or directory 'datafiles/default_list.xls'

I’ve also tried:

var workbook = excel.readFile(basepath + fileName);

which gives me the right absolute path to the file, but still gives the error.

ENOENT, no such file or directory '/Users/brad/Workspaces/listory.proto/datafiles/default_list.xls'

Help! Thanks!

You need to use the Assets api to get these.

As stated in the documentation: http://docs.meteor.com/#/full/assets_getText

Ok - thanks. Not that obvious from the docs, but using Assets API works:

All files inside a top-level directory called private are only accessible from server code and can be loaded via the Assets API. This can be used for private data files and any files that are in your project directory that you don’t want to be accessible from the outside.

Would be better to read like:

can only be loaded via the Assets API.