Can I use Assets.getText from a package?

Hi,

I tried to use:
http://docs.meteor.com/#/full/assets_getText

from a local package. Me hope was, that I can read
some configs from the APP private folder. but I got only an
Error: Unknown asset:

Can Assets.getText in local package only access a private folder inside of the package ?

1 Like

No man! You should add that files as assets: api.addFiles('/myasset.png', 'server', {isAsset: true}). But this asset will be visible by package only

lol yes WE CAN :stuck_out_tongue:
like this

    fs.readFile(process.env.PWD + '/private/blabla/data.json', 'utf8', function (err, data) {
      if (err) {
          console.log('Error: ' + err);
          return;
      }else{
        console.log('Parsing Data Started');
        leData = JSON.parse(data);
        console.log(leData);
      }
    });

and enjoy :slight_smile: run this within a meteor function so you won’t deal with the fiber future issues :wink:

1 Like