File extension type
The 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, or from a drag
and drop operation's DataTransfer object.
A File
object is a specific kind of Blob, and can be used in any context
that a Blob can. In particular, FileReader, URL.createObjectURL_static
,
createImageBitmap
, the
body
option
to fetch
, and XMLHttpRequest accept both Blob
s and File
s.
See Using files from web applications for more information and examples.
Constructors
-
File(JSArray<
BlobPart> fileBits, String fileName, [FilePropertyBag options]) -
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- lastModified → int
-
no setter
- name → String
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
no setterinherited
- type → String
-
no setterinherited
- webkitRelativePath → String
-
no setter
Methods
-
arrayBuffer(
) → JSPromise< JSArrayBuffer> -
The
arrayBuffer()
method of the Blob interface returns aPromise
that resolves with the contents of the blob as binary data contained in anArrayBuffer
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
slice(
[int start, int end, String contentType]) → Blob -
The
slice()
method of the Blob interface creates and returns a newBlob
object which contains data from a subset of the blob on which it's called.inherited -
stream(
) → ReadableStream -
The
stream()
method of the Blob interface returns a ReadableStream which upon reading returns the data contained within theBlob
.inherited -
text(
) → JSPromise< JSString> -
The
text()
method of the Blob interface returns aPromise
that resolves with a string containing the contents of the blob, interpreted as UTF-8.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited