Meteor-CollectionFS
Meteor-CollectionFS copied to clipboard
Is there a way for validating the metadata information ?
Using cfs:gridfs I am looking for a way to validate the inputs in metadata is there a way to do so ? I tried to use the beforeWrite hook, but it doesn't have a way to stop the writing of the file.
You could use the collection-hooks package to check your data before allowing the write. Just returning false to the hook will stop writing the data.
If Media is the name of your collection, you need to write your hook as
Media.files.before.insert((userid, media) => {
// do your validation
if (!valid) {
return false;
}
});