File

open class File(fileBits: ReadonlyArray<BlobPart>, fileName: String, options: FilePropertyBag = definedExternally) : Blob, Serializable(source)

The File interface provides information about files and allows JavaScript in a web page to access their content.

MDN Reference

Constructors

Link copied to clipboard
constructor(fileBits: ReadonlyArray<BlobPart>, fileName: String, options: FilePropertyBag = definedExternally)

Properties

Link copied to clipboard

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

Link copied to clipboard

The name read-only property of the File interface returns the name of the file represented by a File object.

Link copied to clipboard

The size read-only property of the Blob interface returns the size of the Blob or File in bytes.

Link copied to clipboard

The type read-only property of the Blob interface returns the MIME type of the file.

Link copied to clipboard

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

Functions

Link copied to clipboard
suspend fun arrayBuffer(): ArrayBuffer

The arrayBuffer() method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.

Link copied to clipboard
Link copied to clipboard
suspend fun bytes(): Uint8Array<ArrayBuffer>

The bytes() method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.

Link copied to clipboard
Link copied to clipboard
fun slice(start: Int53 = definedExternally, end: Int53 = definedExternally, contentType: String = definedExternally): Blob

The slice() method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called.

Link copied to clipboard

The stream() method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.

Link copied to clipboard
suspend fun text(): String

The text() method of the string containing the contents of the blob, interpreted as UTF-8.

Link copied to clipboard