File
interface provides information about files and allows JavaScript in a web page to access their content.File
objects are generally retrieved from a FileList
object returned as a result of a user selecting files using the <input>
element, from a drag and drop operation's DataTransfer
object, or from the mozGetAsFile()
API on an HTMLCanvasElement
.File
object is a specific kind of a Blob
, and can be used in any context that a Blob can. In particular, FileReader
, URL.createObjectURL()
, createImageBitmap()
, and XMLHttpRequest.send()
accept both Blob
s and File
s.Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight).
Promise<number>
Returns the name of the file referenced by the File
object.
Promise<string>
The size, in bytes, of the data contained in the Blob
object.
Promise<number>
A string indicating the MIME type of the data contained in the Blob
. If the type is unknown, this string is empty.
Promise<string>
Returns a promise that resolves with an ArrayBuffer
containing the entire contents of the Blob
as binary data.
Promise<ArrayBuffer>
Returns a new Blob
object containing the data in the specified range of bytes of the blob on which it's called.
number
. An index into the Blob
indicating the first byte to include in the new Blob
. If you specify a negative value, it's treated as an offset from the end of the Blob
toward the beginning. For example, -10 would be the 10th from last byte in the Blob
. The default value is 0. If you specify a value for start
that is larger than the size of the source Blob
, the returned Blob
has size 0 and contains no data.number
. An index into the Blob
indicating the first byte that will not be included in the new Blob
(i.e. the byte exactly at this index is not included). If you specify a negative value, it's treated as an offset from the end of the Blob
toward the beginning. For example, -10 would be the 10th from last byte in the Blob
. The default value is size
.string
. The content type to assign to the new Blob
; this will be the value of its type
property. The default value is an empty string.Promise<Blob>
Returns a promise that resolves with a string
containing the entire contents of the Blob
interpreted as UTF-8 text.
Promise<string>
stream() |