Web APIs
File
Constructs a File with bytes and metadata; does not read arbitrary disk paths.
Formal Syntax & Structure
javascript syntaxjavascript
new File(parts, name, options)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| parts | array | File content parts. |
| name | string | File name. |
| options | object | Optional type and lastModified. |
Return Value
File
Constructs a File with bytes and metadata; does not read arbitrary disk paths.
Working Example
Example Snippetjavascript
(async () => {const f=new File(["abc"],"notes.txt",{lastModified:1000,type:"text/plain"});console.log(f.name,f.size,f.lastModified);})()