> ## 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.

# encDecode

> Decodes an encoded file or string of data using a specified encoding format.

export const siteNameShort = "Arc";

Decodes an encoded file or string of data.

## Required Parameters

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

* **data**: The data to decode.
* **file**: The file to decode.

## Optional Parameters

* **format**: The format to use for decoding. Available values are **BASE64**, **HEX**, **HTML**, **JIS**, **QP**, **URL**, **UU**, and **YENC**. The default is BASE64.
* **outfile**: The file in which to store the decoded data. This is not supported for **UU** decoding, which uses the filename stored in the encoded file.
* **outformat**: The format to use for decoded data. Available values are **RAW**, **BASE64**, and **HEX**. The default is RAW.
* **encoding**: The encoding to use to convert the decoded byte array into RAW format. The default is UTF-8.

## Output Attributes

* **decodeddata**: The decoded data.
* **format**: The format used for decoding.
* **outfile**: If you specified an input value for **outfile**, this is the file that contains the decoded data.

## Example

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

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

<arc:call op="encDecode" in="enc" out="result">
  <!-- setting the output file data to be the decoded data returned from the operation -->
  <arc:set attr="output.data">[result.decodeddata]</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 article is a real-world use case that uses the encDecode operation:

* <a href="https://arc.cdata.com/kb/articles/arc-http-signature-auth.rst" target="_blank">HTTP Signature Authentication using CData Arc</a>
