tftpClient

D.device. Namespace

tftpClient

Description:
  • The Device TFTP Client library. Allows drivers to execute TFTP client commands towards a TFTP server.
Example
D.device.tftpClient
See TFTP Driver Examples

Methods

(static) download(options, callback)

Description:
  • Retrieves a file content from a remote server using TFTP.
Example
D.device.tftpClient.download(options, callback)
Parameters:
Name Type Description
options Object The TFTP download execution options.
Properties
Name Type Attributes Default Description
filePath string The source file path on the device. It defines the location of the file to be downloaded. Relative to the TFTP server configuration.
port string <optional>
69 The port number of the TFTP server.
blockSize number <optional>
1468 The size of each DATA block in bytes. Must be between 8 and 65464.
windowSize number <optional>
4 The number of blocks that can be sent or received without waiting for an acknowledgment. Valid values range from 1 to 65535.
retries number <optional>
3 The maximum number of retry attempts before an error is triggered.
timeout number <optional>
3000 The time in milliseconds to wait before retrying a failed request.
md5 string <optional>
An optional MD5 checksum to verify the file's integrity.
sha1 string <optional>
An optional SHA1 checksum to verify the file's integrity.
userExtensions object <optional>
Custom extensions that the server may or may not support. These extensions depend on server capabilities. Note: The TFTP algorithm itself cannot be modified. For example, a simple authentication mechanism can be implemented by sending `user` and `password` as extensions, allowing the server to validate credentials and accept or reject the request. However, all extensions are transmitted in plain text. Reserved extensions (`timeout`, `tsize`, `blksize`, `windowsize`, and `rollover`) cannot be used.
callback callback The TFTP download execution callback
Properties
Name Type Attributes Description
output Object <optional>
The tftp download execution result
Properties
Name Type Description
content string The content of file downloaded from the device, if the execution did not result in an error
error ErrorResult <optional>
Will be present if the execution resulted in an error

(static) upload(options, callback)

Description:
  • Transfers a file content to a remote server using TFTP.
Example
D.device.tftpClient.upload(options, callback)
Parameters:
Name Type Description
options object The tftpClient upload execution options
Properties
Name Type Attributes Default Description
filePath string The destination path on the device where the file will be stored, relative to the TFTP server configuration on the device.
content string The data to be written to the file on the device.
port number <optional>
69 The port number of the TFTP server.
blockSize number <optional>
1468 The size of each DATA block in bytes. Must be between 8 and 65464.
windowSize number <optional>
4 The number of blocks that can be sent or received without waiting for an acknowledgment. Valid values range from 1 to 65535.
retries number <optional>
3 The maximum number of retry attempts before an error is triggered.
timeout number <optional>
3000 The time in milliseconds to wait before retrying a failed request.
md5 string <optional>
An optional MD5 checksum to verify the file's integrity.
sha1 string <optional>
An optional SHA1 checksum to verify the file's integrity.
userExtensions object <optional>
Custom extensions that the server may or may not support. These extensions depend on server capabilities. Note: The TFTP algorithm itself cannot be modified. For example, a simple authentication mechanism can be implemented by sending `user` and `password` as extensions, allowing the server to validate credentials and accept or reject the request. However, all extensions are transmitted in plain text. Reserved extensions (`timeout`, `tsize`, `blksize`, `windowsize`, and `rollover`) cannot be used.
callback callback The tftpClient upload execution callback
Properties
Name Type Attributes Description
error ErrorResult <optional>
Will be present if the execution resulted in an error