Giter Site home page Giter Site logo

Comments (9)

dr-dimitru avatar dr-dimitru commented on June 1, 2024

Hello @make-github-pseudonymous-again,

onBeforeUpload is meant for this purpose. As stated in the docs after the first chunk is received. Intermediate collection used to store during upload

from meteor-files.

make-github-pseudonymous-again avatar make-github-pseudonymous-again commented on June 1, 2024

Oh, great! How does one modify the metadata at this stage? Just by modifying the file object? Or do we need to make a query against this intermediate collection? Could onInitiateUpload be used instead? If using onBeforeUpload, should I check for this.chunkId == -1 && !this.eof to only act once?

from meteor-files.

dr-dimitru avatar dr-dimitru commented on June 1, 2024

@make-github-pseudonymous-again on this stage it's possible abort or continue upload, Altering meta-data should happen in onAfterUpload

from meteor-files.

make-github-pseudonymous-again avatar make-github-pseudonymous-again commented on June 1, 2024

I understand. Is there a plan to make this possible in the future? To avoid having yet-another extra layer of "the upload is there but it's not ready for use yet".

from meteor-files.

make-github-pseudonymous-again avatar make-github-pseudonymous-again commented on June 1, 2024

My point is that the upload action finishes before it's metadata is updated in onAfterUpload, so one would have to add extra logic to be synchronized with that event.

from meteor-files.

dr-dimitru avatar dr-dimitru commented on June 1, 2024

@make-github-pseudonymous-again

the upload is there but it's not ready for use yet

Not sure if I've got this one correctly. But it's how it's usually done:

  1. Wait for upload
  2. Wait for verification and processing

from meteor-files.

make-github-pseudonymous-again avatar make-github-pseudonymous-again commented on June 1, 2024

OK. And you don't think this library should allow to abstract those two steps into a single one?

My solution without changing this library is to add an extra flag to each document that says whether certain things in onAfterUpload have run. Then I have to abstract away every Uploads.insert call to wait for this flag to be set, and every publication or method that involves those documents needs to filter documents based on this flag.

from meteor-files.

dr-dimitru avatar dr-dimitru commented on June 1, 2024

OK. And you don't think this library should allow to abstract those two steps into a single one?

No, that would be unnecessary overhead. This lib allows you to control these things.

My solution without changing this library is to add an extra flag to each document that says whether certain things in onAfterUpload have run. Then I have to abstract away every Uploads.insert call to wait for this flag to be set, and every publication or method that involves those documents needs to filter documents based on this flag.

@make-github-pseudonymous-again sounds correct, we were using one of two options:

  1. Add a flag after all post-processing finished; Read/filter from DB based using the flag;
  2. Insert into other collection or update an object in other collection

from meteor-files.

make-github-pseudonymous-again avatar make-github-pseudonymous-again commented on June 1, 2024

OK. Feel free to close!

from meteor-files.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.