From b0a393384aa4021c915e6a650c75ff328a054cb2 Mon Sep 17 00:00:00 2001 From: MDN Date: Thu, 1 Jul 2021 00:37:12 +0000 Subject: [CRON] sync translated content --- files/ja/web/api/body/blob/index.html | 79 ----------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 files/ja/web/api/body/blob/index.html (limited to 'files/ja/web/api/body/blob/index.html') diff --git a/files/ja/web/api/body/blob/index.html b/files/ja/web/api/body/blob/index.html deleted file mode 100644 index 1fb7cf8bbe..0000000000 --- a/files/ja/web/api/body/blob/index.html +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: Body.blob() -slug: Web/API/Body/blob -tags: - - API - - BODY - - Blob - - Experimental - - Fetch - - Method - - Reference -translation_of: Web/API/Body/blob ---- -
{{APIRef("Fetch")}}
- -

{{domxref("Body")}} ミックスインの blob() メソッド は、 {{domxref("Response")}} ストリームを取得し、完全に読み込みます。 {{domxref("Blob")}} で解決する promise を返します。

- -

構文

- -
response.blob().then(function(myBlob) {
-  // do something with myBlob
-});
- -

パラメーター

- -

なし。

- -
: {{domxref("Response")}} の {{domxref("Response.type")}} が "opaque" の場合、結果の {{domxref("Blob")}} の {{domxref("Blob.size")}} は 0、{{domxref("Blob.type")}} は空の文字列 "" になり、{{domxref("URL.createObjectURL")}} のようなメソッドでは役に立たなくなります。
- -

戻り値

- -

{{domxref("Blob")}} で解決する promise。

- -

- -

fetch request の例fetch request をライブで実行)では、{{domxref("Request.Request","Request()")}} コンストラクターを使用して新しいリクエストを作成し、それを使用して JPG をフェッチします。 フェッチが成功したら、blob() を使用してレスポンスから {{domxref("Blob")}} を読み取り、それを {{domxref("URL.createObjectURL")}} を使用してオブジェクト URL に入れ、その URL を {{htmlelement("img")}} 要素のソースとして設定して画像を表示します。

- -
var myImage = document.querySelector('img');
-
-var myRequest = new Request('flowers.jpg');
-
-fetch(myRequest)
-.then(response => response.blob())
-.then(function(myBlob) {
-  var objectURL = URL.createObjectURL(myBlob);
-  myImage.src = objectURL;
-});
-
- -

仕様

- - - - - - - - - - - - - - -
仕様状態コメント
{{SpecName('Fetch','#dom-body-blob','blob()')}}{{Spec2('Fetch')}}
- -

ブラウザーの互換性

- - - -

{{Compat("api.Body.blob")}}

- -

関連情報

- - -- cgit v1.2.3-54-g00ecf