Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Encode in Base64

...

Version 1 (Python)

Группа действий: Базовые действия  Подгруппа Общее

Описание

Действие кодирует данные указанного файла в Base64

Иконка

Image Removed

Параметры

Входные параметры

  1. Выпадающий список "Тип данных" - Тип данных, которые будут кодироваться. 
  2. Поле "Файл"  - Путь к файлу, данные которого будут кодироваться.
  3. Поле "Строка"  - Строка, которая будет кодироваться». 

Выходные параметры:

Поле  "Результат" - Строка с кодированными данными. 

Настройки

...

Тип данных, которые будут кодироваться.

Элементы списка: Файл, Строка.

...

Особые условия использования 

  1. Для кодирования пользователю необходимо указать тип данных для кодировки: файл или строку.
  2. Если пользователь выбрал тип данных, но не указал выбранный тип (файл/строка), то действие отобразит ошибку: "Некорректно заполнены входные параметры".
  3. Результатом действия является строка с кодированными данными.
  4. Существует ограничение на размер файла - 10МБ. При указании файла большего размера действие выдает ошибку в виде сообщения: «Размер файла больше допустимого».

Примеры использования 

Задача 1

Необходимо закодировать данные, передаваемые во входном файле в Base64. 

Решение

  1. Установить действие "Кодировать в Base64" на рабочую область.
  2. Корректно заполнить параметры. "Тип данных" - Файл, 
  3. Запустить робота.

Реализация

...

Action group: Base actions  Subgroup: General

...

Description

The action encodes the data in the specified file in Base64.

Action icon

Image Added

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Data type

The type of data to be encoded.

List elements: File, String.

Robin.String
yes
FilePath to file whose data will be encoded.Robin.PathToFile
no
StringString to be encoded.Robin.String
no
Results
ResultEncoded string.Robin.String

Special conditions of use

  1. To encode the user needs to specify the data type for encoding: file or string.
  2. If the user selected a data type, but did not specify the selected type (file/string), the action will display the error: "Input parameters are not filled correctly".
  3. The result of the action is a string with encoded data.
  4. There is a limitation on file size - 10MB. If you specify a larger file size, the action will generate an error in the form of a message: "The file size is larger than allowed".

Examples of use

Task 1

 Encode the data passed in the input file in Base64.

Solution

  1. Move the "Encode in Base64" action to the workspace.
  2. Set the parameters correctly. "Data type" - File.
  3. Start the robot.

Implementation

  1. Select the file to encode in Base64.
  2. Open the "Base actions" action group.
  3. Move the "Encode in Base64" action to the workspace.
  4. Click on the action.
  5. Action setting:
    1. "Data type" parameter. Select "File" from the dropdown list.
    2. In the"File" field specify the path to the file folder.

    Image Added
  6. Click "Start" in the top panel to start the robot.
    Image Added


Result

The output of the action was a string with Base64 encoded data.

Image Added

Task 2

  1. If parameters are set incorrectly, for example, if the data type is "String", the "String" field should be left blank. 

Image Added

2. Start the robot.

Result

The action encoded the specified string and returned a string with encoded data. The action did not touch the specified file.

Task 3

Repeat the case by specifying "Data type" - File. As a result, the action will not touch the specified string

...

Результат

 Действие выдало результат в виде строки с кодированными в Base64 данными.

Image Removed

Задача 2

  1. При некорректном задании параметров, например при типе данных "Строка" поле "Строка" оставить незаполненным. 

Image Removed

2. Запустить робота.

Результат

Действие кодировало указанную строку и вернуло строку с кодированными данными. Указанный файл действие не трогало.

Задача 3

Повторить кейс, указав "Тип данных" - Файл. В результате действие не будет трогать указанную строку.