This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

close

Summary

Releases the file lock for the associated file resource or frees the memory for the Blob object. After calling this method, performing addition operations on the Blob object fails and throws an exception.

Method of apis/file/Blobapis/file/Blob

Syntax

 Blob.close();

Return Value

No return value

Examples

This example creates a text blob object, reports its size, splits the blob object in half, reports that size, then closes the blob object.

<script>
//create blob
var blobj = new Blob(["I scream, you scream, we <b>all</b> scream for ice cream!"], { "type" : "text/xml" });
alert("Blob size: " + blobj.size);
//slice blob in half, starting at beginning
var blobjfirsthalf = blobj.slice(0, Math.round(blobj.size/2));
alert("Blob first half size: " + blobjfirsthalf.size);
//close blob
blobj.close();
</script>

Related specifications

W3C File API Specification
W3C Working Draft

Attributions