Blob.size
値
BCD tables only load in the browser
Blob
インターフェイスの size
プロパティは、Blob
または File
のサイズをバイト単位で返します。
var sizeInBytes = blob.size
Blob
(または Blob
ベースのオブジェクト、例えばFile
) 内に含まれるデータのバイト数。
この例では、file
型の <input>
要素を使用して、ユーザーにファイルのグループを尋ね、それらのファイルを繰り返し処理して、その名前と長さをバイト単位で出力しています。
// fileInputは HTMLInputElement <input type="file" multiple id="myfileinput"> です。
var fileInput = document.getElementById("myfileinput");
// files は FileList オブジェクトです (NodeList に似ています)。
var files = fileInput.files;
for (var i = 0; i < files.length; i++) {
console.log(files[i].name + " has a size of " + files[i].size + " Bytes");
}
仕様書 | ステータス | コメント |
---|---|---|
File API Blob.size の定義 |
草案 | 初期定義 |