Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

description update for FileReader #33568

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/en-us/web/api/filereader/abort/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/filereader/abort_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/filereader/error_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/filereader/filereader/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/filereader/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/filereader/load_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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")}}.
2 changes: 1 addition & 1 deletion files/en-us/web/api/filereader/loadend_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/filereader/loadstart_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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")}}
2 changes: 1 addition & 1 deletion files/en-us/web/api/filereader/progress_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/filereader/readasarraybuffer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions files/en-us/web/api/filereader/readasbinarystring/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/filereader/readasdataurl/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/filereader/readastext/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down