0

I am trying to build a Meteor package that generates static files for the client to consume. I cannot seem to figure this out. I have tried to write files to the public directory as well as adding assets via compileStep.addAsset, but neither appear to work.

Is there a standard way to do this?

I see a very similar question, but it is a bit old & does not appear to work anymore.

Community
  • 1
  • 1
Markus
  • 518
  • 6
  • 18

1 Answers1

1

Until you find a better solution consider using collectionFS. You can serve from either filesystem or gridfs as shown below. This way you can avoid worrying about mapping urls to the files because collectionFS does it for you.

Images = new FS.Collection("images", {
  stores: [new FS.Store.GridFS("images", {})]
});
Images = new FS.Collection("images", {
  stores: [new FS.Store.FileSystem("images", {path: "C:/uploads"})]
});

Inserting and linking to is handled with the following.

Images.insert(file, function (err, fileObj) {
});
Images.findOne().url();

Add the following packages depending on your usage.

meteor add cfs:standard-packages
meteor add cfs:gridfs
meteor add cfs:filesystem
jackkav
  • 574
  • 4
  • 13
  • Thank you, this looks like half my answer. I think i can use this to retrieve my files via the client. But i get a `__meteor_bootstrap__ is not defined` whenever i try to use this as a build plugin. Any idea how i can insert files into this collection? – Markus Jun 16 '15 at 18:58