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

> BASE64、HEX、SHA などの指定したエンコード形式で、ファイルまたはデータ文字列をエンコードします。

export const siteNameShort = "Arc";

指定したエンコード形式で、ファイルまたはデータ文字列をエンコードします。

## 必要なパラメータ

次のフィールドのいずれか一方に値を指定する必要があります（両方は指定できません）：

* **data**: エンコードするデータ。
* **file**: エンコードするファイル。

## オプションのパラメータ

* **format**: エンコードに使用するフォーマット。使用可能な値は**BASE64**、**HEX**、**HMAC**、**HTML**、**JIS**、**MD5**、**QP**、**SHA1**、**URL**、**UU**、**YENC** です。デフォルトはBASE64 です。
* **outfile**: エンコードしたデータを保存するファイル。
* **outformat**: エンコードしたデータに使用するフォーマット。使用可能な値は**RAW**、**BASE64**、**HEX** です。デフォルトはRAW です。
* **encoding**: エンコードの前にデータをバイト配列に変換するために使用するエンコード。デフォルトはUTF-8 です。

## アウトプット属性

* **encodeddata**: エンコードされたデータ。
* **format**: エンコードに使用されたフォーマット。
* **outfile**: **outfile** にインプット値を指定した場合の、エンコードされたデータを含むファイル。

## 例

次の{siteNameShort}Script コードは、[Script コネクタ](../../connectors/script)に配置すると、**\[FilePath]** のインプットファイルからデータを読み取り、デフォルトのBASE64 形式でエンコードしてからファイルをプッシュします：

```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" />
```

## 関連リソース

次の記事は、encEncode オペレーションを使用した実際のユースケースです：

* <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>
