A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/en-US/docs/Web/API/Blob/size below:

Blob: size property - Web APIs

Blob: size property

Baseline Widely available

Note: This feature is available in Web Workers.

The size read-only property of the Blob interface returns the size of the Blob or File in bytes.

Value

The number of bytes of data contained within the Blob (or Blob-based object, such as a File).

Examples

This example uses an <input> element of type file to ask the user for a group of files, then iterates over those files outputting their names and lengths in bytes.

HTML
<input type="file" id="input" multiple />
<output id="output">Choose files…</output>
output {
  display: block;
  margin-top: 16px;
}
JavaScript
const input = document.getElementById("input");
const output = document.getElementById("output");

input.addEventListener("change", (event) => {
  output.innerText = "";

  for (const file of event.target.files) {
    output.innerText += `${file.name} has a size of ${file.size} bytes.\n`;
  }
});
Result Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4