Navigation

encode

On this page

Definition

encode

Encodes incoming binary data into specified format and outputs a document with the field data which holds the encoded string.

The encode action cannot be in the first stage of a pipeline. The stage preceding the encode action stage must output a stream of binary data.

The encode action stage has the following syntax:

Tip

In the stages, the action arguments can make use of variables (%%vars) defined for the stage as well as defined constants and expansions.

{"service": "", "action": "encode", "args": {"encoding": <"hex"|"base64">}}

The encode action has the following arguments:

Argument Type Description
encoding string

Encoding format for outgoing data. Specify either:

  • "hex"
  • "base64"

For example, consider the following pipeline of two stages:

[
  {"service": "", "action": "binary", "args": {"encoding": "base64", "data": "VGhlIGNvdyBpcyBicm93bi4="}},
  {"service": "", "action": "encode", "args": {"encoding": "hex"}}
]

Stage1: The binary stage outputs a decoded output stream of binary data.

Stage2: The encode stage reads the input stream and encodes into binary data and outputs the following document:

{
   "data": "54686520636f772069732062726f776e2e"
}
←   binary expr  →