CulturalMe / meteor-slingshot

Upload files directly to AWS S3, Google Cloud Storage and others in meteor
MIT License
595 stars 104 forks source link

Feature: accept function for allowedFileTypes to pass meta #216

Open sungwoncho opened 7 years ago

sungwoncho commented 7 years ago

It'd be handy to meta to allowedFileTypes to dynamically decide the file types allowed. This can be done in a similar manner done by passing meta to key.

e.g.

Slingshot.createDirective('my-directive', Slingshot.S3Storage,
  ...
  allowedFileTypes(meta) {
    if (meta.foo) {
      return [ 'image/jpeg' ];
    }
    return [ 'image/png' ]
  },
  ...
);

Any thoughts?