Wed. Jan 26th, 2022

Requirement: I have REST WebService which is used to download a file from the Oracle UCM Server. The file extension is .csv

Now, when I invoke the REST WebService passing value of the valid parameter(s), it returns me the response in which the Document Content is Base64Encoded.

Thus, in this post, I will show you the JavaScript function that will Decode and Download the Document Content which is Base64Encoded.

Solution: For the solution of the above requirement we will use the below JavaScript code.

define([], function() {
  'use strict';

  var PageModule = function PageModule() {};

  PageModule.prototype.downloadFile_CSV = function(fileBytes) {
    var blob;
    blob = window.atob(fileBytes);
    var link = document.createElement("a");
    if ( !== undefined) {
      console.log('Susanto 4' + blob);
      link.href = 'data:text/csv;charset=utf-8,' + encodeURI(blob); = '_blank'; = 'output.csv';;

  return PageModule;

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 1,110 total views,  2 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *