File objects are generally retrieved from a
FileList object returned as a result of a user selecting files using the
<input> element, or from a drag and drop operation's
File object is a specific kind of
Blob, and can be used in any context that a Blob can. In particular,
XMLHttpRequest.send() accept both
See Using files from web applications for more information and examples.
Returns a newly constructed
Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight).
File.prototype.lastModifiedDateDeprecated Read only Non-standard
Returns the last modified
Dateof the file referenced by the
Returns the name of the file referenced by the
Returns the path the URL of the
Fileis relative to.
Blob, so it also has the following properties available to it:
Returns the size of the file in bytes.
Returns the MIME type of the file.
File interface doesn't define any methods, but inherits methods from the
Blob.prototype.slice([start[, end[, contentType]]])
Returns a new
Blobobject containing the data in the specified range of bytes of the source
ReadableStreamthat can be used to read the
Fileinto a stream and reads it to completion. It returns a promise that resolves with a string (text).
Fileinto a stream and reads it to completion. It returns a promise that resolves with an
|File API |
BCD tables only load in the browser
- Using files from web applications
- Using the DOM File API in chrome code (for privileged code running in Gecko, such as Firefox add-ons)