This package allows you to attach files to your sequelize instances as easy as you set your plain attributes and define MIME type validation and post-processing rules next to your models.
- ImageMagick (
brew install imagemagickon OS X).
First, you define which fileds you want to enhance with attachments logic:
/* models/attachments.js */;const picture =;const backgroundImage =;
Then, you attach enhanced attributes to your model:
/* models/User.js */;;;let User = sequelize;picture;backgroundImage;;
After this, you'll be able to set files just as ordinary sequelize attributes. You can attach files either as urls (they will be downloaded), or as pre-downloaded multer-style objects (basically, only
mimetype props are required)
You access all of your resized images through dot notation. If you didn't setup resizing, you'll get a string path to attached file.
This package is under early development. Do use it with caution! Check out tests to see what is currently working.