Ivan Bacher
Ivan Bacher

Reputation: 6154

File upload - How to get upload progress using Cloudinary Node.js SDk

Looking though the docs, there are two ways of uploading files (images, videos, ...) to cloudinary using the node.js sdk.

Is there some way of getting progress reports when using either of the below specified methods? E.g 1 of 100mb have been uploaded.

cloudinary.v2.uploader.upload_large(filePath, options, (err, results) => {});
cloudinary.v2.uploader.upload(filePath, options, (err, results) => {});

Upvotes: 0

Views: 642

Answers (1)

Shirly Manor
Shirly Manor

Reputation: 301

For assets larger than this limit (100MB) you must request that the derived versions are created before they're requested, which we call 'eagerly', and that the processing takes place in the background ('asynchronously'). When using asynchronous eager transformations you can manipulate the asset as large as your account's maximum video/image file size limit.

Eager transformations can be requested for new asset in the upload API call or configured in an upload preset, including an upload preset that is used when you upload to Media Library. For existing videos, you can request eager transformations via the explicit API method. Once the video is transformed eagerly/asynchronously it will be available via the URL as normal.

For example in node:

cloudinary.v2.uploader.upload("sample.jpg", 
  { eager: [
      { width: 300, height: 300, crop: "pad" }, 
      { width: 160, height: 100, crop: "crop", gravity: "south"} ],                                   
    eager_async: true,
    eager_notification_url: "https://mysite.example.com/eager_endpoint",
    notification_url: "https://mysite.example.com/upload_endpoint" }, 
  function(error, result) {console.log(result, error); });

Upvotes: 1

Related Questions