1 of 20
2 of 20
3 of 20
4 of 20
5 of 20
6 of 20
7 of 20
8 of 20
9 of 20
10 of 20
11 of 20
12 of 20
13 of 20
14 of 20
15 of 20
16 of 20
17 of 20
18 of 20
19 of 20
20 of 20

doc

File

The File interface allows JavaScript in a web page to access the content in a file by giving information about files.

Instance properties

File.prototype.lastModified Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at midnight).

File.prototype.name Returns the name of the file referenced by the File object.

File.prototype.webkitRelativePath Returns the path the URL of the File is relative to.

File implements Blob, so it also has the following properties available to it:

File.prototype.size Returns the size of the file in bytes.

File.prototype.type Returns the MIME type of the file.

Instance methods

Blob.prototype.slice([start[, end[, contentType]]]) Returns a new Blob object containing the data in the specified range of bytes of the source Blob.

Blob.prototype.stream() Transforms the File into a ReadableStream that can be used to read the File contents.

Blob.prototype.text() Transforms the File into a stream and reads it to completion. It returns a promise that resolves with a string (text).

Blob.prototype.arrayBuffer() Transforms the File into a stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer.

For more information on File visit MDN Web Docs.


Didn’t find what you were looking for? Open a support ticket.