aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/blob/text
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/blob/text
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/blob/text')
-rw-r--r--files/ja/web/api/blob/text/index.html79
1 files changed, 79 insertions, 0 deletions
diff --git a/files/ja/web/api/blob/text/index.html b/files/ja/web/api/blob/text/index.html
new file mode 100644
index 0000000000..13fa929a00
--- /dev/null
+++ b/files/ja/web/api/blob/text/index.html
@@ -0,0 +1,79 @@
+---
+title: Blob.text()
+slug: Web/API/Blob/text
+tags:
+ - API
+ - Blob
+ - File API
+ - Method
+ - Reference
+ - String
+ - Text
+ - Utf-8
+ - get
+ - read
+translation_of: Web/API/Blob/text
+---
+<div>{{APIRef("File API")}}</div>
+
+<p><span class="seoSummary">{{domxref("Blob")}} インターフェイスの <code><strong>text()</strong></code> メソッドは {{jsxref("Promise")}} を返しますが、それは Blob の内容を含む文字列で解決され、UTF-8 として解釈されます。</span></p>
+
+<ul>
+</ul>
+
+<h2 id="シンタックス">シンタックス</h2>
+
+<pre class="syntaxbox notranslate">var <em>textPromise</em> = <em>blob</em>.text();
+
+<em>blob</em>.text().then(<em>text</em> =&gt; /* テキストに対して処理をする */);
+
+var <em>text</em> = await <em>blob</em>.text();
+</pre>
+
+<h3 id="パラメータ">パラメータ</h3>
+
+<p>なし</p>
+
+<h3 id="戻り値">戻り値</h3>
+
+<p>Blob のデータをテキスト文字列として含む {{domxref("USVString")}} で解決する Promise。データは<em>常に</em> UTF-8 形式であると推定されます。</p>
+
+<h2 id="使用上のメモ">使用上のメモ</h2>
+
+<p>{{domxref("FileReader")}} メソッド {{domxref("FileReader.readAsText", "readAsText()")}} は、同様の機能を実行する古いメソッドです。これは、<code>Blob</code> と {{domxref("File")}} オブジェクトの両方で動作します。主な違いは2つあります。</p>
+
+<ul>
+ <li><code>Blob.text()</code> が Promise を返すのに対し、<code>FileReader.readAsText()</code> はイベントベースの API です</li>
+ <li><code>Blob.text()</code> は常にエンコーディングとして UTF-8 を使用しますが、<code>FileReader.readAsText()</code> は Blob のタイプと指定されたエンコーディング名に応じて異なるエンコーディングを使用することができます</li>
+</ul>
+
+<h2 id="仕様">仕様</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">仕様書</th>
+ <th scope="col">ステータス</th>
+ <th scope="col">コメント</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("File API", "#dom-blob-text", "Blob.text()")}}</td>
+ <td>{{Spec2("File API")}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="ブラウザの互換性">ブラウザの互換性</h2>
+
+<div class="hidden">このページの互換性一覧表は、構造化データから生成されています。データに貢献したい方は、https://github.com/mdn/browser-compat-data をチェックしてプルリクエストを送ってください。</div>
+
+<p>{{Compat("api.Blob.text")}}</p>
+
+<h2 id="あわせて参照">あわせて参照</h2>
+
+<ul>
+ <li>{{domxref("Body.text()")}}</li>
+ <li><a href="/ja/docs/Web/API/Streams_API">Streams API</a></li>
+ <li>{{domxref("FileReader.readAsText()")}}</li>
+</ul>