Get file data
Gets file from server as binary data
Function GetFileData(Val Connection, Val Path) Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
Connection | - | Arbitrary | ✔ | Existing connection or connection configuration |
Path | - | String | ✔ | Path to file on server |
Returns: Map Of KeyAndValue, BinaryData - File data or error information
tip
FTP Command: RETR
caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
Host = "172.33.0.10";
Port = "21";
Login = "bayselonarrend";
Password = "12we...";
UseProxy = True;
FTPS = True;
ProxySettings = Undefined;
TLSSettings = Undefined; // FTPS
FTPSettings = OPI_FTP.GetConnectionSettings(Host, Port, Login, Password);
If UseProxy Then
ProxyType = "http"; // http, socks5, socks4
ProxyAddress = "127.0.0.1";
ProxyPort = "8071";
ProxyLogin = "proxyuser";
ProxyPassword = "12we...";
ProxySettings = OPI_FTP.GetProxySettings(ProxyAddress, ProxyPort, ProxyType, ProxyLogin, ProxyPassword);
EndIf;
If FTPS Then
TLSSettings = OPI_FTP.GetTLSSettings(True);
EndIf;
Connection = OPI_FTP.CreateConnection(FTPSettings, ProxySettings, TLSSettings);
If OPI_FTP.IsConnector(Connection) Then
Path = "new_dir/big.bin";
Result = OPI_FTP.GetFileData(Connection, Path);
Else
Result = Connection; // Error of connection
EndIf;
Result
NOT JSON: 52 61 72 21 1A 07 01 00 30 23 12 A7 10 01 05 0C 00 0B 01 01 8B C8 8F A0 81 80 80 80 00 F8 44 59 F3 37 02 03 0B 85 E4 02 04 A0 DE 08 A0 40 52 47 4A ED 80 43 00 18 61 73 73 65 74 73 2F 69 6E 64…