File

@native @JSGlobal @JSType
class File(bits: Iterable[BlobPart], _name: String, options: FilePropertyBag) extends Blob

The File interface provides information about -- and access to the contents of -- files.

These 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.

The file reference can be saved when the form is submitted while the user is offline, so that the data can be retrieved and uploaded when the Internet connection is restored.

class Blob
class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

def lastModified: Double

The File.lastModified read-only property provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.

The File.lastModified read-only property provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.

def name: String

Returns the name of the file. For security reasons, the path is excluded from this property.

Returns the name of the file. For security reasons, the path is excluded from this property.

def webkitRelativePath: String

The File.webkitRelativePath is a read-only property that contains a string which specifies the file's path relative to the directory selected by the user in an element with its webkitdirectory attribute set.

The File.webkitRelativePath is a read-only property that contains a string which specifies the file's path relative to the directory selected by the user in an element with its webkitdirectory attribute set.

Returns:

A string containing the path of the file relative to the ancestor directory the user selected.

Inherited methods

def `type`: String

A string indicating the MIME type of the data contained in the Blob. If the type is unknown, this string is empty.

A string indicating the MIME type of the data contained in the Blob. If the type is unknown, this string is empty.

Inherited from:
Blob
def arrayBuffer(): Promise[ArrayBuffer]

Returns a promise that resolves with an ArrayBuffer containing the entire contents of the blob as binary data.

Returns a promise that resolves with an ArrayBuffer containing the entire contents of the blob as binary data.

Inherited from:
Blob
def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def size: Double

The size, in bytes, of the data contained in the Blob object.

The size, in bytes, of the data contained in the Blob object.

Inherited from:
Blob
def slice(start: Double, end: Double, contentType: String): Blob

A string indicating the MIME type of the data contained in the Blob. If the type is unknown, this string is empty.

A string indicating the MIME type of the data contained in the Blob. If the type is unknown, this string is empty.

Inherited from:
Blob
def stream(): ReadableStream[Uint8Array]

Returns a ReadableStream that can be used to read the contents of the blob.

Returns a ReadableStream that can be used to read the contents of the blob.

Inherited from:
Blob
def text(): Promise[String]

Returns a promise that resolves with a USVString containing the entire contents of the blob interpreted as UTF-8 text.

Returns a promise that resolves with a USVString containing the entire contents of the blob interpreted as UTF-8 text.

See also:
Inherited from:
Blob
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object

Deprecated and Inherited methods

@deprecated("This method seems to have been added in error and not actually exist.", "1.2.0")
def close(): Unit
Deprecated
Inherited from:
Blob