veliovgroup / Meteor-Files

🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.
https://packosphere.com/ostrio/files
BSD 3-Clause "New" or "Revised" License
1.11k stars 166 forks source link

How to prevent displaying the file until onAfterUpload has finished #825

Closed jankapunkt closed 3 years ago

jankapunkt commented 3 years ago

I am uploading sound files and transform all file formats on the server with ffmpeg to mp3 for best support.

However, I am replacing the original file completely. Basically my onAfterUpload is structured in the following steps (way too much code to show here):

Until this process finishes I don't want to preview the file but display something like "processing file....".

The issue is, the client does not know, when onAfterUpload has finished. I could, of course simply add a flag to the document like processFinished: false and subscribe to it, so it automatically updates.

However, I wanted to know, if there is any mechanism already builtin that implements such behavior.

dr-dimitru commented 3 years ago

Hello @jankapunkt ,

I'd recommend setting meta.isReady or meta.isFullyUploaded, since meta is the only object with open schema if you follow all guidelines and schema validation.

dr-dimitru commented 3 years ago

@jankapunkt the same way we set the error, like meta.processingError

jankapunkt commented 3 years ago

@dr-dimitru thank you I am doing that now. I was just thinking, if there was already some builtin mechanism so I don't need additional collection access. However, it's doing its job and overhead seems neglectible.