How to download attachment in VBCS
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);