apply-codecs()

string apply-codecs(string input, string ...codecs)

apply-codecs expects at least two strings as parameters. The first parameter is the input. The next parameters are the codecs to be applied in sequence, so that the first codec is applied to the given input and the next codecs are applied to the result of the previous encoding process. Returns a string.

The following codecs are supported:

Example

<flow>
  <template>
  {
    {{$input := 'my input' }}
    {{$encoded := apply-codecs($input, 'deflate', 'base64-encode', 'url-encode') }}
    <!-- is the same as -->
    {{$deflated := apply-codecs($input, 'deflate') }}
    {{$base64encoded := apply-codecs($deflated, 'base64-encode') }}
    {{$encoded := apply-codecs($base64encoded, 'url-encode') }}
  }
  </template>
<flow>

Last updated