File()
构造函数创建新
File
对象实例。
new File(bits, name[, options]);
bits
数组
of
ArrayBuffer
,
ArrayBufferView
,
Blob
,
USVString
objects, or a mix of any of such objects, that will be put inside the
File
.
USVString
objects are encoded as UTF-8.
名称
USVString
representing the file name or the path to the file.
选项
可选
type
: A
DOMString
representing the MIME type of the content that will be put into the file. Defaults to a value of
"".
lastModified
: A number representing the number of milliseconds between the Unix time epoch and when the file was last modified. Defaults to a value of
Date.now()
.
var file = new File(["foo"], "foo.txt", {
type: "text/plain",
});
| 规范 | 状态 | 注释 |
|---|---|---|
| 文件 API | 工作草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
File()
构造函数
|
Chrome 13 | Edge 79 | Firefox 7 | IE No | Opera 11.5 | Safari 10.1 | WebView Android ≤37 | Chrome Android 18 | Firefox Android 7 | Opera Android 11.5 | Safari iOS 6 | Samsung Internet Android 1.0 |
完整支持
不支持