Download File

Download File

External Assemblies

To download a file in a C# scripted function, you must first go to the .NET Global section (after you choose to create a global script as found HERE), and in the External Assemblies box, enter the following: System.dll,System.Net.dll

C# Script to Download file as a byte array

object ScriptedField()
{
	var url = "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png";
	return new System.Net.WebClient().DownloadData(url);
}

C# Script to Download file as a Base64 string

object ScriptedField()
{
	var url = "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png";
	return Convert.ToBase64String(new System.Net.WebClient().DownloadData(url));
}

    • Related Articles

    • File System Connector

      File System Origin The File System Connector reads all files from a folder specified in the Directory field. The Username and Password fields are not used. Filter can be used to filter for certain file names/extensions. To search for all files with ...
    • Import Starfish Map file from a locally stored *.SPD file

      Import Starfish Map file from a locally stored *.SPD file Step Snapshot Go to project and select the Import view Select Browse to import the *.spd file Select *.spd file from directory folder. Once the import is complete, the project will be added to ...
    • Interact with the local file system

      Read files from a folder Function ScriptedVariable Dim fso, folder, files, sFolder, res Set fso = CreateObject("Scripting.FileSystemObject") sFolder = "C:\Results" Set folder = fso.GetFolder(sFolder) Set files = folder.Files For each folderIdx In ...
    • Upload a file to FTP or sFTP

      To upload a file in a C# scripted function, you must first go to the .NET Global section, and in the External Assemblies box, enter the following: System.dll void CSharpProcedure() { var client = new System.Net.WebClient(); string dt = ...
    • Pull data from a source and write to file

      With this map, I wanted to pull all accounts from a Sugar instance and dump a few fields into a pipe delineated file. In this map I used the same Sugar instance as both the Origin and Destination. There were no Stages created, so no action was taken ...