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: `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.):FileInfo

Parameters

string name
    The name to save the file as.

string mimeType
    The MIME type of the file.

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. options
    Download options. See FileTransferOptions for more details.

Returns

The created FileInfo.

Remarks

Download a remote file into the repository

 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);

See Also