MqttSyncClient.DownloadFile 方法 (String, String, Action<Int64, Int64>, Stream, HslCancelToken) |
[文件引擎] 从远程服务器下载一个文件到流中,需要指定文件类别,文件名,进度报告,本地保存的文件名
To download a file from a remote server to the stream, you need to specify the file category, file name, progress report, and file name saved locally
命名空间:
HslCommunication.MQTT
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public OperateResult DownloadFile(
string groups,
string fileName,
Action<long, long> processReport,
Stream stream,
HslCancelToken cancelToken = null
)
Public Function DownloadFile (
groups As String,
fileName As String,
processReport As Action(Of Long, Long),
stream As Stream,
Optional cancelToken As HslCancelToken = Nothing
) As OperateResult
public:
OperateResult^ DownloadFile(
String^ groups,
String^ fileName,
Action<long long, long long>^ processReport,
Stream^ stream,
HslCancelToken^ cancelToken = nullptr
)
member DownloadFile :
groups : string *
fileName : string *
processReport : Action<int64, int64> *
stream : Stream *
?cancelToken : HslCancelToken
(* Defaults:
let _cancelToken = defaultArg cancelToken null
*)
-> OperateResult
参数
- groups
- 类型:System.String
文件的类别,例如 Files/Personal/Admin 按照斜杠来区分 - fileName
- 类型:System.String
文件名称,例如 123.txt - processReport
- 类型:System.Action<Int64, Int64>
进度报告,第一个参数是已完成字节数,第二个参数是总字节数 - stream
- 类型:System.IO.Stream
数据流 - cancelToken (Optional)
- 类型:HslCommunication.Core.HslCancelToken
取消下载操作的令牌
返回值
类型:
OperateResult是否下载成功
参见