2
votes

Background: I'm working on file uploading in Meteor.js, when I do a hot code push the client refresh their pages, but if they are during a file upload this stops.

My question: "Is the Meteor hot code push a total refresh of the app?"

  • If so then I'm out of luck, since the file input cannot survive in a session/cookie. but:
  • If not then how can I recieve hot code push event? (is there a Meteor.addListener for this?)

(no, I dont have any code since this is a general Meteor.js question)

1
I don't think there will be a way to make it survive, however could you make a resumable, chunked upload? So the user will notice a pause but then it should restart.David Wihl
It's resumable, but would be nice not to bother the user giving the file pointer/input again. collectionfs.meteor.comRaiX

1 Answers

2
votes

The way hot code push works is it serializes your application state and refreshes the page, then restores the state. Unfortunately, file uploads are a little complicated. I imagine you're not actually storing the file upload progress in your app state, which means that if the page refreshes, it won't start up again all by itself and continue.

To fix this, you could first store the uploading file locally in a database and upload it from there. Keep track of how much has been uploaded, and then when the app refreshes, tell the app to continue from where it left off.

Obviously this is a non-trivial problem. Personally I would probably consider this an edge case and ask the user to re-upload the file rather than investing all the time needed into engineering a solution. Unless your app use case consists entirely of uploading files, at which point you have a challenge on your hands :-)