> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# encEncode

> Encodes a file or string of data in a specified encoding format such as BASE64, HEX, or SHA.

export const siteNameShort = "Arc";

Encodes a file or string of data in a specified encoding format.

## Required Parameters

You must provide a value for one of the following fields, but not both:

* **data**: The data to encode.
* **file**: The file to encode.

## Optional Parameters

* **format**: The format to use for encoding. Available values are **BASE64**, **HEX**, **HMAC**, **HTML**, **JIS**, **MD5**, **QP**, **SHA1**, **URL**, **UU**, and **YENC**. The default is BASE64.
* **outfile**: The file in which to store the encoded data.
* **outformat**: The format to use for encoded data. Available values are **RAW**, **BASE64**, and **HEX**. The default is RAW.
* **encoding**: The encoding to use to convert data into a byte array before encoding. The default is UTF-8.

## Output Attributes

* **encodeddata**: The encoded data.
* **format**: The format used for encoding.
* **outfile**: If you specified an input value for **outfile**, this is the file that contains the encoded data.

## Example

The following {siteNameShort}Script code, when placed in a [Script connector](../../connectors/script), reads data from an input file at **\[FilePath]**, encodes it in the default BASE64 format, then pushes the file out:

```xml theme={null}
<!-- setting the file and format for the input item -->
<arc:set attr="enc.file" value="[FilePath]" />
<arc:set attr="enc.format" value="BASE64" />

<arc:call op="encEncode" in="enc" out="result">
  <!-- setting the output file data to be the encoded data returned from the operation -->
  <arc:set attr="output.data">[result.encodeddata]</arc:set>
</arc:call>

<!-- setting the filename and pushing the file out -->
<arc:set attr="output.filename" value="[FileName]" />
<arc:push item="output" />
```

## Additional Resources

The following articles are real-world use cases that use the encEncode operation:

* <a href="https://arc.cdata.com/kb/articles/arc-http-signature-auth.rst" target="_blank">HTTP Signature Authentication using CData Arc</a>
* <a href="https://community.cdata.com/cdata-arc-48/custom-signature-authentication-in-the-webhook-connector-281" target="_blank">Custom Signature Authentication in the Webhook Connector</a>
