FileReader.readyState
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.
FileReader
の readyState
プロパティは、 FileReader
がいる読み取り操作の現在の状態を提供します。 FileReader
は以下のいずれかの状態にあります。
値 | 状態 | 説明 |
---|---|---|
0 |
EMPTY |
Reader が作成されました。まだ読み込まれているメソッドはありません。 |
1 |
LOADING |
read メソッドが呼び出されました。 |
2 |
DONE |
操作が完了しています。 |
例
js
const reader = new FileReader();
console.log("EMPTY", reader.readyState); // readyState は 0 になります。
reader.readAsText(blob);
console.log("LOADING", reader.readyState); // readyState は 1 になります。
reader.onloadend = () => {
console.log("DONE", reader.readyState); // readyState は 2 になります。
};
値
FileReader
API のために定義されている、状態を表す 3 つの定数のうちの 1 つです。
仕様書
Specification |
---|
File API # dom-filereader-readystate |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
readyState |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.