Read All Bytes

Verb: readAllBytes

Available from: <Standard>

Reads a file and returns all its contents in a byte list.

Syntax

readAllBytes --filepath(String) [--fileSystem(FileSystem)] (List<Byte>)=value

Inputs

Script Designer Required AcceptedTypes Description
--filepath File Path Required Text Full path to the file that should be read.
--fileSystem File System Optional File System Connection variable to a file system.
1. To obtain the connection variable with an available file system, this connection must be established using one of the following commands: IBM RPA Control Center.
2. If nothing is specified in this parameter, the local file system of the operating system is used as default.

Outputs

Script Designer AcceptedTypes Description
value Bytes List List<Byte> Variable containing the byte list of the given file.

Example

The Read All Bytes command reads a file, with the default operating system file system, and returns its contents in a byte list displayed on the console by the command Log Message.

defVar --name bytesList --type List --innertype Byte
// Download the following file to execute the command.
readAllBytes --filepath "fileReadAllBytes.jpg" bytesList=value
logMessage --message "${bytesList}" --type "Info"
// Show in the console the byte list of the given file.

Download File


For the script to work properly, you must download the file and enter its path in the File Path parameter of the Read All Bytes command.

See Also

  • Check If Directory Exists
  • Convert Base64 to File
  • Convert File to Base64
  • Copy File
  • Count Files
  • Create Directory
  • Delete Directory
  • Delete File
  • Delete from Directory
  • Download from File System
  • Get Directories
  • Get Files
  • If File Exists
  • Move File
  • Read All Text
  • Rename File
  • Send to File System
  • Write to File