generating and serving static files with Meteor

后端 未结 4 1573
温柔的废话
温柔的废话 2020-12-02 16:23

I\'m looking to create static text files based upon the content of a supplied object, which can then be downloaded by the user. Here\'s what I was planning on doing:

4条回答
  •  抹茶落季
    2020-12-02 16:26

    I was stuck at the exact same problem, where i need the users to upload files in contrast to your server generated files. I solved it sort of by creating an "uploads" folder as sibling to the "client public server" on the same folder level. and then i created a simbolic link to the '.meteor/local/build/static' folder like

    ln -s ../../../../uploads .meteor/local/build/static/ 
    

    but with nodejs filesystem api at server start time

    Meteor.startup(function () {
        var fs = Npm.require('fs');
    
        fs.symlinkSync('../../../../uploads', '.meteor/local/build/static/uploads'); 
    };
    

    in your case you may have a folder like "generatedFiles" instead of my "uploads" folder you need to do this every time the server starts up cuz these folders are generated every time the server starts up e.g. a file changes in your implementation.

提交回复
热议问题