diff options
Diffstat (limited to 'files/de/orphaned/web/api/body/blob/index.html')
-rw-r--r-- | files/de/orphaned/web/api/body/blob/index.html | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/files/de/orphaned/web/api/body/blob/index.html b/files/de/orphaned/web/api/body/blob/index.html deleted file mode 100644 index dc687a369e..0000000000 --- a/files/de/orphaned/web/api/body/blob/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Body.blob() -slug: orphaned/Web/API/Body/blob -translation_of: Web/API/Body/blob -original_slug: Web/API/Body/blob ---- -<div>{{APIRef("Fetch")}}</div> - -<p>Die Methode <strong><code>blob()</code></strong> des {{domxref("Body")}} Mixin nimmt einen {{domxref("Response")}} Stream und liest ihn bis zum Ende. Sie gibt ein Promise zurück, welches in einen {{domxref("Blob")}} aufgelöst wird.</p> - -<h2 id="Syntax">Syntax</h2> - -<pre class="brush: js">response.blob().then(function(myBlob) { - // mach etwas mit myBlob -});</pre> - -<h3 id="Parameter">Parameter</h3> - -<p>Keine.</p> - -<div class="note"><strong>Hinweis:</strong> Wenn die {{domxref("Response")}} vom {{domxref("Response.type")}} her <code>"opaque"</code> ist, hat der resultierende {{domxref("Blob")}} eine {{domxref("Blob.size")}} von <code>0</code> und einen {{domxref("Blob.type")}} eines leeren Strings <code>""</code>, wodurch er für Methoden wie {{domxref("URL.createObjectURL")}} <em>unbrauchbar</em> wird.</div> - -<h3 id="Rückgabewert">Rückgabewert</h3> - -<p>Ein Promise, welches in einen {{domxref("Blob")}} aufgelöst wird.</p> - -<h2 id="Beispiel">Beispiel</h2> - -<p>In unserem <a href="https://github.com/mdn/fetch-examples/tree/master/fetch-request">Beispiel für eine Fetch Anfrage</a> (<a href="http://mdn.github.io/fetch-examples/fetch-request/">live ausführen</a>) erstellen wir eine neue Anfrage mit dem {{domxref("Request.Request")}} Konstruktor und rufen dann ein JPG ab. Wenn der Abruf erfolgreich ist, lesen wir mit <code>blob()</code> einen {{domxref("Blob")}} aus der Antwort, fügen ihn mit {{domxref("URL.createObjectURL")}} in eine Objekt-URL ein und legen diese URL als Quelle für das {{htmlelement("img")}} Element zum Anzeigen des Bildes fest.</p> - -<pre class="brush: js">var myImage = document.querySelector('img'); - -var myRequest = new Request('flowers.jpg'); - -fetch(myRequest) -.then(function(response) { - return response.blob(); -}) -.then(function(myBlob) { - var objectURL = URL.createObjectURL(myBlob); - myImage.src = objectURL; -}); -</pre> - -<h2 id="Spezifikationen">Spezifikationen</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('Fetch','#dom-body-blob','blob()')}}</td> - <td>{{Spec2('Fetch')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Browserkompatibilität">Browserkompatibilität</h2> - - - -<p>{{Compat("api.Body.blob")}}</p> - -<h2 id="Siehe_auch">Siehe auch</h2> - -<ul> - <li><a href="/de/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li> - <li><a href="/de/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li> - <li><a href="/de/docs/Web/HTTP">HTTP</a></li> -</ul> |