September 2017
Intermediate to advanced
450 pages
11h 24m
English
One detail about our change to using a cloud storage service such as Cloudinary for our images still remains. We are still writing our images to our local filesystem before uploading them. An easy solution to this problem is to move away from relying on the file system of our operating system entirely and using a memory-based solution instead. Luckily, Multer provides simple drop in support for such a solution.
First, we will create two new methods in our /middleware/cloudinary.js middleware. These methods will added support to Cloudinary's upload_stream API by passing a file buffer from Multer to it:
...uploadBuffer: function(buffer, options) { if (!options) options = { discard_original_filename: true }; return function
Read now
Unlock full access