What's the best way to download a large text file?

We’re making a method call to download a roughly 20MB json array. We do this using a very simple query and a basic method call. We don’t want this data to be reactive, we store it for use offline via our own framework.

But the call is slow, 10 seconds when running locally and over 1 minute running on Modulus. We’re looking for ways to optimise this. Is using a Method call the way to go? If we don’t need reactive functionality is a plain HTTP Get going to be faster?

Also, does anyone know if a Method call like this includes compression?

Just in case, here’s some code. Under /server we have

Meteor.methods({
  getBigDataFile: function(myId) {
    var query = {
      'someid': myId,
    };
    return BigData.find(query).fetch();
  }
});

We call it using

Meteor.call('getBigDataFile', theId, function(err, result){
  // We store the data offline here
});

Thanks

I would check to see if the EJSON type Binary is maybe more efficient as a start. Now it gets in the flow of the normal DDP requests.

If it’s not reactive it means that the data is quite static? I might also opt for testing delivery as a file. So store it on S3 or something else and just send the url over to allow the client to download it by itself. That is an optimized downloading store. DDP is a synchronization method which is not specifically focussed on downloading bigger files.