coderef

File APIBaseline · Widely available

The File API represents and reads from file data and metadata. Typically, you get files through other APIs, such as the <input type="file"> element or drag-and-drop events. You may also send file data to other APIs, such as creating images or drawing on canvases.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jan 15, 2020. Widely available since Jul 15, 2022.

Browser support

DesktopChrome
1–37Not supported
38+Supportedsince Oct 7, 2014
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–27Not supported
28+Supportedsince Mar 18, 2014
Current: 157
Safari
1–10Not supported
10.1+Supportedsince Mar 27, 2017
Current: 27
MobileChrome Android
18–37Not supported
38+Supportedsince Oct 8, 2014
Current: 155
Firefox Android
4–27Not supported
28+Supportedsince Mar 18, 2014
Current: 157
Safari iOS
1–10Not supported
10.3+Supportedsince Mar 27, 2017
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: Blob.

Feature detection

JS · check before using
if ("File" in globalThis) {
  // File is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (40). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Blob512461846
Blob.Blob201213625146
Blob.arrayBuffer76796914767914.5
Blob.bytes1441441281814412818
Blob.size512461846
Blob.slice211213725147
Blob.stream76796914.1767914.5
Blob.text76796914767914.5
Blob.type512461846
File1312341843.2
File.File38792810.1382810.3
File.lastModified13181510181510
File.name13123.681848
FileList212341843.2
FileList.item212341843.2
FileList.length212341843.2
FileReader6123.6618326
FileReader.FileReader6123.6618326
FileReader.abort6123.6618326
FileReader.abort_event6123.6618326
Show 20 more
Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
FileReader.error6123.6618326
FileReader.error_event6123.6618326
FileReader.load_event6123.6618326
FileReader.loadend_event6123.6618326
FileReader.loadstart_event61279618796
FileReader.progress_event6123.6618326
FileReader.readAsArrayBuffer6123.6618326
FileReader.readAsDataURL6123.6618326
FileReader.readAsText6123.6618326
FileReader.readyState6123.6618326
FileReader.result6123.6618326
FileReader.worker_support61246618466
FileReaderSync712861886
FileReaderSync.FileReaderSync712861886
FileReaderSync.readAsArrayBuffer912861886
FileReaderSync.readAsDataURL712861886
FileReaderSync.readAsText712861886
FileReaderSync.worker_support712861886
URL.createObjectURL_static321219732197
URL.revokeObjectURL_static321219732197