How it works...

Cloudinary, as a service, provides us with a Node.js module full of ready-made tools to use to communicate with their service. After initializing the module with our secret API credentials, we will simply need to invoke the APIs within their module, and the details of the work are done for us.

The upload method takes a local file reference and uploads it to Cloudinary with a callback when it succeeds or fails in this operation, as follows:

cloudinary.v2.uploader.upload(file, options, callback);

It can also support an options object, which can be used to customize several aspects of the uploaded image. One of the great things about Cloudinary is the remarkable amount of customization options available for working with images. ...

Get MEAN Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.