Comments (9)
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.
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.
@make-github-pseudonymous-again on this stage it's possible abort or continue upload, Altering meta-data should happen in onAfterUpload
from meteor-files.
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.
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.
@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:
- Wait for upload
- Wait for verification and processing
from meteor-files.
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.
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 everyUploads.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:
- Add a flag after all post-processing finished; Read/filter from DB based using the flag;
- Insert into other collection or update an object in other collection
from meteor-files.
OK. Feel free to close!
from meteor-files.
Related Issues (20)
- fails with `onBeforeUpload returned false [403]`, but my onBeforeUpload returns true HOT 7
- How namingFunction was changed from 2.0.1 to 2.2.1 ? Uploading files does not work. HOT 10
- Updating Files HOT 4
- allowedOrigins error at server.js line 277 HOT 9
- onAfterUpload is missing context HOT 3
- Slow file uploading after meteor upgrade HOT 18
- findOne(undefined) gives the same result as findOne() HOT 2
- Can't upload files on meteor `production`. HOT 3
- Trying to upload a blob as wav file and getting `Maximum call stack size exceeded` HOT 2
- ENOENT: no such file or directory, mkdir HOT 18
- onBeforeUpload and other functions should be able to be asynchronous HOT 1
- Custom Endpoint for MinIO ? HOT 2
- What defines the filename of the saved file? HOT 2
- Async support HOT 23
- [FilesCollection.ServiceFile] Path "/assets/app/uploads/ServiceFileCollection" is not writable! HOT 2
- How do I update a filesCollection after Server side Write created? HOT 1
- Get user ip on upload HOT 9
- Since Meteor 2.11 - Exception in setTimeout callback: TypeError: fs.remove is not a function HOT 9
- Question: Can you store directly in GridFS? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-files.