Skip to content

Download

Downloads a file from a remote environment, stores it in the repository, and returns the created FileInfo.

1
myFiles.Download(name: string, mimeType: string, options: FileTransferOptions):FileInfo

Parameters

string name
    The name of the file to be saved.

string mimeType
    The MIME type of the file.

FileTransferOptions options
    Download options. See FileTransferOptions for more details.

Returns

The created FileInfo.

Remarks

Downloading a file from a URL:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
//Creating File Transfer Option
var fileTransferOptions = {
    RemoteHost : 'www.emakin.com',   //Url
    RemotePath : 'images/image.jpg', //Location
    Port : 80,                       //Port
    Protocol : 'HTTP'                //Protocol
};

//Downloading File
var file = $Files.Download("FileName", 'image/jpeg', fileTransferOptions);

Types

FileTransferOptions

Options for file transfer operations.

Password : string
The password to authenticate with on the remote environment. Optional.

Port : number
The port number of the remote environment. Optional.

Protocol : ( "FTP" | "FTPS" | "SFTP" | "HTTP" | "HTTPS" )
The protocol to use for file transfer. Optional. The default is

RemoteHost : string
The IP address or host name of the remote environment.

RemotePath : string
The path of the file on the remote environment.

UserName : string
The username to authenticate with on the remote environment. Optional.

See Also