You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to download attachment in VBCS

edited Dec 13, 2019 9:51AM in Visual Builder 4 comments

Content

Hi,

 We are storing file as blob in PaaS DB and we are using REST API to fetch content of the file.

On button action I am calling REST API which is returning BLOB format content and I am passing those content to below code snippet.

 I am using below code for on downloading  any type of file.

 PageModule.prototype.preview = function(blobData, contentType) {
    if (contentType === undefined || contentType.length === 0) {
      contentType = "multipart/form-data";
    }
    var newBlob = new Blob([blobData], {type: contentType});
    return URL. createObjectURL(newBlob);
  };
 
  PageModule.prototype.download = function(blobData, contentType, fileName) {
    console.log("Blob"+blobData);
    console.log("contentType"+contentType);
    console.log("fileName"+fileName);

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!