Blob.size
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
값
Blob
또는 File
과 같은 Blob
기반 객체의 데이터 크기를 바이트 단위로 나타낸 숫자입니다.
예제
이 예제는 file
유형의 <input>
요소를 통해 사용자가 선택한 여러 파일을 순회하면서, 각각의 파일 이름과 바이트 크기를 출력합니다.
HTML
html
<input type="file" id="input" multiple />
<output id="output">파일 선택...</output>
JavaScript
js
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}의 크기는 ${file.size} 바이트입니다.\n`;
}
});
결과
명세
Specification |
---|
File API # dfn-size |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
size |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.