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

## [](#tobase641)toBase64(content: 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>

### [](#例)例

次の例では、バイナリ値を、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//..."
```