Skip to content

Commit

Permalink
Update files/en-us/web/api/file/index.md
Browse files Browse the repository at this point in the history
Co-authored-by: wbamberg <[email protected]>
  • Loading branch information
skyclouds2001 and wbamberg authored Sep 29, 2024
1 parent 82b84b0 commit 2de1cae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion files/en-us/web/api/file/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ The **`File`** interface provides information about files and allows JavaScript

`File` objects are generally retrieved 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.

A `File` object is a specific kind of {{DOMxRef("Blob")}}, and can be used in any context that a Blob can. In particular, {{DOMxRef("FileReader")}}, {{DOMxRef("URL.createObjectURL_static", "URL.createObjectURL()")}}, {{DOMxRef("Window.createImageBitmap", "createImageBitmap()")}}, the [`body`](/en-US/docs/Web/API/RequestInit#body) option to {{domxref("Window/fetch", "fetch()")}}, and {{DOMxRef("XMLHttpRequest.send()")}} accept both `Blob`s and `File`s.
A `File` object is a specific kind of {{DOMxRef("Blob")}}, and can be used in any context that a Blob can. In particular, the following APIs accept both `Blob`s and `File` objects:

- {{DOMxRef("FileReader")}}
- {{DOMxRef("URL.createObjectURL_static", "URL.createObjectURL()")}}
- {{DOMxRef("Window.createImageBitmap()")}} and {{DOMxRef("WorkerGlobalScope.createImageBitmap()")}}
- the [`body`](/en-US/docs/Web/API/RequestInit#body) option to {{domxref("Window/fetch", "fetch()")}}
- {{DOMxRef("XMLHttpRequest.send()")}} .

See [Using files from web applications](/en-US/docs/Web/API/File_API/Using_files_from_web_applications) for more information and examples.

Expand Down

0 comments on commit 2de1cae

Please sign in to comment.