From e68a0515ce9ab8ea8030ea004051680b6dc3a169 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Mon, 13 May 2024 03:01:40 +0800 Subject: [PATCH 1/3] description update --- files/en-us/web/api/filereader/abort/index.md | 2 +- files/en-us/web/api/filereader/abort_event/index.md | 2 +- files/en-us/web/api/filereader/error_event/index.md | 2 +- files/en-us/web/api/filereader/filereader/index.md | 2 +- files/en-us/web/api/filereader/index.md | 2 +- files/en-us/web/api/filereader/load_event/index.md | 2 +- files/en-us/web/api/filereader/loadend_event/index.md | 2 +- files/en-us/web/api/filereader/loadstart_event/index.md | 2 +- files/en-us/web/api/filereader/progress_event/index.md | 2 +- files/en-us/web/api/filereader/readasarraybuffer/index.md | 6 +++--- .../en-us/web/api/filereader/readasbinarystring/index.md | 8 ++++---- files/en-us/web/api/filereader/readasdataurl/index.md | 6 +++--- files/en-us/web/api/filereader/readastext/index.md | 4 ++-- 13 files changed, 21 insertions(+), 21 deletions(-) diff --git a/files/en-us/web/api/filereader/abort/index.md b/files/en-us/web/api/filereader/abort/index.md index b99b15c873396a4..d6b2c84fdfb123d 100644 --- a/files/en-us/web/api/filereader/abort/index.md +++ b/files/en-us/web/api/filereader/abort/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.abort {{APIRef("File API")}}{{AvailableInWorkers}} -The **`abort`** method of the {{domxref("FileReader")}} interface aborts the read operation. Upon return, +The **`abort()`** method of the {{domxref("FileReader")}} interface aborts the read operation. Upon return, the {{domxref("FileReader.readyState","readyState")}} will be `DONE`. ## Syntax diff --git a/files/en-us/web/api/filereader/abort_event/index.md b/files/en-us/web/api/filereader/abort_event/index.md index 548b3799c195aee..26943f4b386e320 100644 --- a/files/en-us/web/api/filereader/abort_event/index.md +++ b/files/en-us/web/api/filereader/abort_event/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.abort_event {{APIRef("File API")}}{{AvailableInWorkers}} -The **`abort`** event is fired when a read has been aborted: for instance because the program called {{domxref("FileReader.abort()")}}. +The **`abort`** event of the {{domxref("FileReader")}} interface is fired when a read has been aborted: for instance because the program called {{domxref("FileReader.abort()")}}. This event is not cancelable and does not bubble. diff --git a/files/en-us/web/api/filereader/error_event/index.md b/files/en-us/web/api/filereader/error_event/index.md index 92bda4b5fe01ba8..6febd11bf0ca6e2 100644 --- a/files/en-us/web/api/filereader/error_event/index.md +++ b/files/en-us/web/api/filereader/error_event/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.error_event {{APIRef("File API")}}{{AvailableInWorkers}} -The **`error`** event is fired when the read failed due to an error (for example, because the file was not found or not readable). +The **`error`** event of the {{domxref("FileReader")}} interface is fired when the read failed due to an error (for example, because the file was not found or not readable). This event is not cancelable and does not bubble. diff --git a/files/en-us/web/api/filereader/filereader/index.md b/files/en-us/web/api/filereader/filereader/index.md index 02e329561c9df91..398035a6f1a8e64 100644 --- a/files/en-us/web/api/filereader/filereader/index.md +++ b/files/en-us/web/api/filereader/filereader/index.md @@ -24,7 +24,7 @@ None. ## Examples -The following code snippet shows creation of a [`FileReader`](/en-US/docs/Web/API/FileReader) object using the `FileReader()` constructor and subsequent usage of the object: +The following code snippet shows creation of a {{domxref("FileReader")}} object using the `FileReader()` constructor and subsequent usage of the object: ```js function printFile(file) { diff --git a/files/en-us/web/api/filereader/index.md b/files/en-us/web/api/filereader/index.md index a2f9819f518d6fd..2a2321d644e0c2a 100644 --- a/files/en-us/web/api/filereader/index.md +++ b/files/en-us/web/api/filereader/index.md @@ -7,7 +7,7 @@ browser-compat: api.FileReader {{APIRef("File API")}}{{AvailableInWorkers}} -The **`FileReader`** object lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using {{domxref("File")}} or {{domxref("Blob")}} objects to specify the file or data to read. +The **`FileReader`** interface lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using {{domxref("File")}} or {{domxref("Blob")}} objects to specify the file or data to read. File objects may be obtained from a {{domxref("FileList")}} object returned as a result of a user selecting files using the {{HTMLElement("input")}} element, or from a drag and drop operation's {{domxref("DataTransfer")}} object. diff --git a/files/en-us/web/api/filereader/load_event/index.md b/files/en-us/web/api/filereader/load_event/index.md index 7285c7d7ab3afb1..8af8fe4080fe94a 100644 --- a/files/en-us/web/api/filereader/load_event/index.md +++ b/files/en-us/web/api/filereader/load_event/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.load_event {{APIRef("File API")}}{{AvailableInWorkers}} -The **`load`** event is fired when a file has been read successfully. +The **`load`** event of the {{domxref("FileReader")}} interface is fired when a file has been read successfully. This event is not cancelable and does not bubble. diff --git a/files/en-us/web/api/filereader/loadend_event/index.md b/files/en-us/web/api/filereader/loadend_event/index.md index 9cc03eec52dda80..77749508c80ddc4 100644 --- a/files/en-us/web/api/filereader/loadend_event/index.md +++ b/files/en-us/web/api/filereader/loadend_event/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.loadend_event {{APIRef("File API")}}{{AvailableInWorkers}} -The **`loadend`** event is fired when a file read has completed, successfully or not. +The **`loadend`** event of the {{domxref("FileReader")}} interface is fired when a file read has completed, successfully or not. This event is not cancelable and does not bubble. diff --git a/files/en-us/web/api/filereader/loadstart_event/index.md b/files/en-us/web/api/filereader/loadstart_event/index.md index 4806b93097f22aa..809d74d0ccad939 100644 --- a/files/en-us/web/api/filereader/loadstart_event/index.md +++ b/files/en-us/web/api/filereader/loadstart_event/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.loadstart_event {{APIRef("File API")}}{{AvailableInWorkers}} -The **`loadstart`** event is fired when a file read operation has begun. +The **`loadstart`** event of the {{domxref("FileReader")}} interface is fired when a file read operation has begun. This event is not cancelable and does not bubble. diff --git a/files/en-us/web/api/filereader/progress_event/index.md b/files/en-us/web/api/filereader/progress_event/index.md index ac68c885f5c064a..3d2ff0acf649599 100644 --- a/files/en-us/web/api/filereader/progress_event/index.md +++ b/files/en-us/web/api/filereader/progress_event/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.progress_event {{APIRef("File API")}}{{AvailableInWorkers}} -The **`progress`** event is fired periodically as the `FileReader` reads data. +The **`progress`** event of the {{domxref("FileReader")}} interface is fired periodically as the `FileReader` reads data. This event is not cancelable and does not bubble. diff --git a/files/en-us/web/api/filereader/readasarraybuffer/index.md b/files/en-us/web/api/filereader/readasarraybuffer/index.md index 30679180311c40c..19d98d0bd6c08d6 100644 --- a/files/en-us/web/api/filereader/readasarraybuffer/index.md +++ b/files/en-us/web/api/filereader/readasarraybuffer/index.md @@ -10,9 +10,9 @@ browser-compat: api.FileReader.readAsArrayBuffer The **`readAsArrayBuffer()`** method of the {{domxref("FileReader")}} interface is used to start reading the contents of a specified {{domxref("Blob")}} or {{domxref("File")}}. When the read -operation is finished, the {{domxref("FileReader.readyState","readyState")}} becomes -`DONE`, and the {{domxref("FileReader/loadend_event", "loadend")}} is -triggered. At that time, the {{domxref("FileReader.result","result")}} attribute +operation is finished, the {{domxref("FileReader.readyState","readyState")}} property becomes +`DONE`, and the {{domxref("FileReader/loadend_event", "loadend")}} event is +triggered. At that time, the {{domxref("FileReader.result","result")}} property contains an {{jsxref("ArrayBuffer")}} representing the file's data. > **Note:** The {{domxref("Blob.arrayBuffer()")}} method is a newer promise-based API to read a diff --git a/files/en-us/web/api/filereader/readasbinarystring/index.md b/files/en-us/web/api/filereader/readasbinarystring/index.md index 185e28887dc6587..9dc45a1a9e3684b 100644 --- a/files/en-us/web/api/filereader/readasbinarystring/index.md +++ b/files/en-us/web/api/filereader/readasbinarystring/index.md @@ -12,11 +12,11 @@ browser-compat: api.FileReader.readAsBinaryString > **Note:** This method is deprecated in favor of {{DOMxRef("FileReader.readAsArrayBuffer","readAsArrayBuffer()")}}. -The **`readAsBinaryString`** method of the {{domxref("FileReader")}} interface is used to start reading the contents of the +The **`readAsBinaryString()`** method of the {{domxref("FileReader")}} interface is used to start reading the contents of the specified {{domxref("Blob")}} or {{domxref("File")}}. When the read operation is -finished, the {{domxref("FileReader.readyState","readyState")}} becomes -`DONE`, and the {{domxref("FileReader.loadend_event")}} is triggered. At that time, the -{{domxref("FileReader.result","result")}} attribute contains the raw binary data from +finished, the {{domxref("FileReader.readyState","readyState")}} property becomes +`DONE`, and the {{domxref("FileReader/loadend_event", "loadend")}} event is triggered. At that time, the +{{domxref("FileReader.result","result")}} property contains the raw binary data from the file. Note that this method was once removed from the File API specification, but diff --git a/files/en-us/web/api/filereader/readasdataurl/index.md b/files/en-us/web/api/filereader/readasdataurl/index.md index 16fc78e6ee4a105..b8daf82d8f783b8 100644 --- a/files/en-us/web/api/filereader/readasdataurl/index.md +++ b/files/en-us/web/api/filereader/readasdataurl/index.md @@ -8,10 +8,10 @@ browser-compat: api.FileReader.readAsDataURL {{APIRef("File API")}}{{AvailableInWorkers}} -The **`readAsDataURL`** method of the {{domxref("FileReader")}} interface is used to read the contents of the specified +The **`readAsDataURL()`** method of the {{domxref("FileReader")}} interface is used to read the contents of the specified {{domxref("Blob")}} or {{domxref("File")}}. When the read operation is finished, the -{{domxref("FileReader.readyState","readyState")}} becomes `DONE`, and the -{{domxref("FileReader/loadend_event", "loadend")}} is triggered. At that time, the +{{domxref("FileReader.readyState","readyState")}} property becomes `DONE`, and the +{{domxref("FileReader/loadend_event", "loadend")}} event is triggered. At that time, the {{domxref("FileReader.result","result")}} attribute contains the data as a [data: URL](/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs) representing the file's data as a base64 encoded string. diff --git a/files/en-us/web/api/filereader/readastext/index.md b/files/en-us/web/api/filereader/readastext/index.md index 19bd073da6692a2..3e157801415009a 100644 --- a/files/en-us/web/api/filereader/readastext/index.md +++ b/files/en-us/web/api/filereader/readastext/index.md @@ -9,12 +9,12 @@ browser-compat: api.FileReader.readAsText {{APIRef("File API")}}{{AvailableInWorkers}} The **`readAsText()`** method of the {{domxref("FileReader")}} interface is used to read the contents of the specified {{domxref("Blob")}} or {{domxref("File")}}. -When the read operation is complete, the {{domxref("FileReader.readyState","readyState")}} is changed to `DONE`, +When the read operation is complete, the {{domxref("FileReader.readyState","readyState")}} property is changed to `DONE`, the {{domxref("FileReader/loadend_event", "loadend")}} event is triggered, and the {{domxref("FileReader.result","result")}} property contains the contents of the file as a text string. > **Note:** The {{domxref("Blob.text()")}} method is a newer promise-based API to read a file as text. -> **Note:** This method loads the entire file's content into memory and is not suitable for large files. Prefer [`readAsArrayBuffer()`](/en-US/docs/Web/API/FileReader/readAsArrayBuffer) for large files. +> **Note:** This method loads the entire file's content into memory and is not suitable for large files. Prefer {{domxref("FileReader.readAsArrayBuffer", "readAsArrayBuffer()")}} for large files. ## Syntax From 5029f5d82977091c8b7c9e77a86a557d7d44c964 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Mon, 13 May 2024 03:29:43 +0800 Subject: [PATCH 2/3] tiny fix --- files/en-us/web/api/filereader/filereader/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/filereader/filereader/index.md b/files/en-us/web/api/filereader/filereader/index.md index 398035a6f1a8e64..67386cde3dce9f9 100644 --- a/files/en-us/web/api/filereader/filereader/index.md +++ b/files/en-us/web/api/filereader/filereader/index.md @@ -8,7 +8,7 @@ browser-compat: api.FileReader.FileReader {{APIRef("File API")}}{{AvailableInWorkers}} -The **`FileReader()`** constructor creates a new FileReader. +The **`FileReader()`** constructor creates a new `FileReader`. For details about how to use `FileReader`, see [Using files from web applications](/en-US/docs/Web/API/File_API/Using_files_from_web_applications). From 00675f76bdfe3e29294932c1cf47ac949f8fcda9 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Tue, 14 May 2024 02:13:50 +0800 Subject: [PATCH 3/3] update event list --- files/en-us/web/api/filereader/load_event/index.md | 2 +- files/en-us/web/api/filereader/loadstart_event/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/filereader/load_event/index.md b/files/en-us/web/api/filereader/load_event/index.md index 8af8fe4080fe94a..b364f851dd567e6 100644 --- a/files/en-us/web/api/filereader/load_event/index.md +++ b/files/en-us/web/api/filereader/load_event/index.md @@ -154,4 +154,4 @@ fileInput.addEventListener("change", handleSelected); ## See also -- Related events: {{domxref("FileReader.loadstart_event")}}, {{domxref("FileReader.loadend_event")}}, {{domxref("FileReader.progress_event")}}, {{domxref("FileReader.error_event")}}, {{domxref("FileReader.abort_event")}} +- Related events: {{domxref("FileReader.loadstart_event", "loadstart")}}, {{domxref("FileReader.loadend_event", "loadend")}}, {{domxref("FileReader.progress_event", "progress")}}, {{domxref("FileReader.error_event", "error")}}, {{domxref("FileReader.abort_event", "abort")}}. diff --git a/files/en-us/web/api/filereader/loadstart_event/index.md b/files/en-us/web/api/filereader/loadstart_event/index.md index 809d74d0ccad939..2a1b33fe22b330b 100644 --- a/files/en-us/web/api/filereader/loadstart_event/index.md +++ b/files/en-us/web/api/filereader/loadstart_event/index.md @@ -154,4 +154,4 @@ fileInput.addEventListener("change", handleSelected); ## See also -- Related events: {{domxref("FileReader.load_event")}}, {{domxref("FileReader.loadend_event")}}, {{domxref("FileReader.progress_event")}}, {{domxref("FileReader.error_event")}}, {{domxref("FileReader.abort_event")}} +- Related events: {{domxref("FileReader.loadend_event", "loadend")}}, {{domxref("FileReader.load_event", "load")}}, {{domxref("FileReader.progress_event", "progress")}}, {{domxref("FileReader.error_event", "error")}}, {{domxref("FileReader.abort_event", "abort")}}