forked from node-file-api/file-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (33 loc) · 811 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// HTML5 File API
// http://www.w3.org/TR/FileAPI
(function () {
"use strict";
var FileApi = module.exports = {
File: require('File')
, FileList: require('FileList')
//, FileError: require('file-error')
, FileReader: require('filereader')
, FormData: require('formdata')
};
FileApi.isFile = function (obj) {
if (obj instanceof FileApi.File) {
return true;
}
if ('string' === typeof obj.name
&& (obj.path || obj.stream || obj.buffer)) {
return true;
}
return false;
};
FileApi.isFormData = function (obj) {
if (obj instanceof FileApi.FormData) {
return true;
}
if ('function' === typeof obj.append
&& 'function' === typeof obj.serialize) {
return true;
}
return false;
};
}());