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)
- [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
- Question: Save link in database?
- Update aws-sdk to v3 in 'Use AWS:S3 As Storage' Documentation HOT 4
- Files.load -> options.fileName is not in filepath HOT 2
- FilesCollection.find(...).each() not working properly? HOT 1
- HTTP uploads not working, multi-instance/cluster environment NGINX balanced HOT 5
- onAfterUpload not throwing error in uploader.on('end') HOT 5
- Cannot stream a video with filenames longer than 80 characters HOT 1
- wrong custom error message when using HTTP
- Make Meteor-Files compatible with meteor-desktop? HOT 4
- Uncaught error when uploading an empty file
- Help Wanted: Method '_FilesCollectionAbort_attachments' not found [404] HOT 1
- Match error: Unknown key in field HOT 5
- User can not be determined in protected callback in Firefox HOT 5
- [3.0.0-beta.6] fileObj._id on upload end ? HOT 10
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.