---
schema_version: "1"
id: a596b20913aca46641d54ce2ae16df72cc51dd3e191e8844dcec93dd117ddf27
title: toBase64
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.3/dw-binaries-functions-tobase64.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.3/dw-binaries-functions-tobase64
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e225137e8541e1d9567b196d5777fb476fe20b20f2a2ba4ac22e2d195f861e73
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
# toBase64

## [](#tobase641)toBase64(Binary): String

バイナリ値を Base64 文字列に変換します。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>content</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換するバイナリ値。</p></td>
</tr>
</tbody>
</table>

### [](#toBase64-example)例

次の例では、バイナリ値を、Base64 でエンコードされた文字列に変換します。この場合、バイナリ値は画像を表します。

#### [](#ソース)ソース

```DataWeave
%dw 2.0

import dw::Crypto
import toBase64 from dw::core::Binaries

var emailChecksum = Crypto::MD5("achaval@gmail.com" as Binary)
var image = readUrl(log("https://www.gravatar.com/avatar/$(emailChecksum)"), "application/octet-stream")

output application/json
---
toBase64(image)
```

#### [](#出力)出力

次の例では、Base64 でエンコードされた文字列を出力します。結果の文字列は、読みやすくするために短縮されています。

```JSON
"/9j/4AAQSkZJRgABAQEAYABgAAD//..."
```