Creating Download Content Component
This feature is used to download any file from Amazon S3 server by using S3 Content Management Service component of Contineo.
Steps
Create the component S3 Content Management Service from the Settings menu by specifying valid credentials.
Create the component Download Content from the Actions menu and specify the property Content Management Service (= S3 service created in step 1 above).
Create one JavaScript from the Actions menu.
Write the following code in the property Properties. The file is downloaded.
Prerequisite to Upload/Download from S3
Configure S3 Settings in Contineo
Click Application, then click More, select Routing. Open the Library Overrides tab.
Drag S3 Content Management Service. Click the dragged component to open the Properties panel.
Add S3 details in Properties > Connection Properties.
Create an Action with the type Download Content.
In the Properties > Input > Content Management Services dropdown list, select S3 Content Management Service.
In this example
downloadfilefroms3indicusis the name of the action created in step 1.JavaScript Example:
vardownloadAPI = context.getApi("downloadfilefroms3indicus");downloadAPI.fileName ="download/01e88c78-8065-4aca-918d-1ab91e6793b7.csv";context.log("downloadAPI.fileName"+ downloadAPI.fileName);downloadAPI.contentType ="text";downloadAPI.contentDownloadFolder = utils.getRootPath() +'content/temp/';context.log("finalPathForBrowserFile"+ downloadAPI.contentDownloadFolder);context.log("downloadAPI.contentDownloadFolder : "+ downloadAPI.contentDownloadFolder);varresult = downloadAPI.execute();context.log("DownloadAPI Result: "+ result);// for viewing file in browser --var finalPathForBrowserFile = result.replace("/opt/tomcat/webapps/ROOT/", "https://trial.contineonx.com/");context.log("finalPathForBrowserFile : "+ finalPathForBrowserFile);Click SAVE.