How to design a system for combining a set of Word documents?

I’m creating an application that allows a user to upload Activities (each Activity has a small Word document associated with it) and then use those activities to create Programs (each program contains a list of activities). I want the user to be able to print a Program (by combining the Word documents of each Activity in the program).

This is how the activity files are being uploaded:

var activityFilesStore = new FS.Store.GridFS("activityFiles");
ActivityFiles = new FS.Collection("activityFiles", {
  stores: [activityFilesStore]
});

Meteor.methods({
    uploadFiles: function (files) {
      check(files, [Object]);

      if (files.length < 1)
        throw new Meteor.Error("invalid-files", "No files were uploaded");

      var documentPaths = [];

      _.each(files, function (file) {
        ActivityFiles.insert(file, function (error, fileObj) {
          if (error) {
            console.log("Could not upload file");
          } else {
            documentPaths.push("/cfs/files/activities/" + fileObj._id);
          }
        });
      });

      return documentPaths;
    }
});

Here’s where I am stuck. I want to use the docx-builder package to try and combine the Word documents into one file that can be printed out.

I’m creating another server side function to create this functionality:

import builder from 'docx-builder';
import fs from 'fs';

Meteor.methods({
  createProgramDocument: function(program) {
    var docx = new builder.Document();
    // Each program has a list of the IDs of the Activities it has.
    program.activityIds.forEach(function(id) {
      // Each activity has a list of the IDs of the Documents it has.
      Activities.find(id).fetch().pop().documents.forEach(function(document) {
        var documentId = document._id
        var file = null; // TODO - Get Word file.
        docx.insertDocxSync(file);
      });
    });
    docx.save("output.docx", function(error)) {
      if (error) {
        console.log(error);
      } else {
        console.log('Document creation successful.');
      }
    }
  }
});

Right now, I am stuck on retrieving the documents by the ID. So, I’d appreciate it if someone could point out how to get that .docx document so I can use the docx-builder library with it. Secondly, if this is being done server side, where should I store the resultant final document and serve it to the client ?

I’m still a bit lost on the big picture and the design choices here. I’m worried about the workload on the server, but since I cannot access the docx-builder library (because it uses the fs package) on client side, this is my only option.

I’m new to Meteor, so any and all criticism of the choices made in this project are welcome.