Showing the progress bar during the conversion of file into another format


#1

Hi,

I’m making enhancements in existing application, that involves conversion of the .g to .obj file. To make it user friendly, I want to add a progress bar that shows how much percent of the conversion is completed. I have tried using " tomi:upload-server and tomi:upload-jquery " packages but whenever I add them into my application, app stop working.

I also explored and got to know the package “PowerQueue” is also used for this purpose. I tried using it but I think I don’t know the right way to use it so kindly please help me.

test.html

<template name="cfsUploader">
    <div class="container">
        <h2> Upload File </h2>
        <p class = "help-text"> Add .g file that you want to upload </p>
        <input type="file" class="form-control" id="fileInput" accept=".g"/>
    </div>
</template>

test.js (Client)

Template.cfsUploader.events({
    'change #fileInput': function(event, temp)
    {
     uploadFile(event, temp);
    }
});

function uploadFile(event, temp)
{
    FS.Utility.eachFile(event, function(file) {
    var fileId;
    var fsFile = new FS.File(file);
    fsFile.owner = Meteor.userId();
    fsFile.converted = false;
    fsFile.timeUploaded = new Date();
    fsFile.about = "The model " + fsFile.name() + " was uploaded on " + fsFile.timeUploaded;
    fsFile.thumbnail = new FS.File();
    fsFile.lovers = [];
    
    ModelFiles.insert(fsFile,function(err,fileObj) {
        if (err) {
        throwError(err.reason);
         } else {
        throwNotification( "File Uploaded, and will appear in file manager after it's converted"); 
        Router.go("/description/" +fileObj._id);  
        }
    }); 
    });
}