(args, done)
| 95 | }; |
| 96 | |
| 97 | const convertToArrayBuffer = function(args, done) { |
| 98 | const [name, obj] = Array.from(args); |
| 99 | const isBlob = instOf(obj, "Blob"); |
| 100 | const isFile = instOf(obj, "File"); |
| 101 | if (!isBlob && !isFile) { |
| 102 | return 0; |
| 103 | } |
| 104 | const reader = new FileReader(); |
| 105 | reader.onload = function() { |
| 106 | // clear value |
| 107 | args[1] = null; |
| 108 | // formdata.append(name, value, **filename**) |
| 109 | if (isFile) { |
| 110 | args[2] = obj.name; |
| 111 | } |
| 112 | return done(["XD_BLOB", args, this.result, obj.type]); |
| 113 | }; |
| 114 | reader.readAsArrayBuffer(obj); |
| 115 | return 1; |
| 116 | }; |
| 117 | |
| 118 | //this FormData is actually XHooks custom FormData `fd`, |
| 119 | //which exposes all `entries` added, where each entry |
no outgoing calls
no test coverage detected