(files)
| 122 | }, |
| 123 | |
| 124 | async _reduceFiles(files) { |
| 125 | const { peer } = this; |
| 126 | |
| 127 | if (files.length === 1) { |
| 128 | return Promise.resolve(files[0]); |
| 129 | } |
| 130 | |
| 131 | const zip = new JSZip(); |
| 132 | |
| 133 | Array.prototype.forEach.call(files, (file) => { |
| 134 | zip.file(file.name, file); |
| 135 | }); |
| 136 | |
| 137 | const blob = await zip.generateAsync( |
| 138 | { type: 'blob', streamFiles: true }, |
| 139 | (metadata) => { |
| 140 | peer.set('bundlingProgress', metadata.percent / 100); |
| 141 | }, |
| 142 | ); |
| 143 | |
| 144 | return new File( |
| 145 | [blob], |
| 146 | `sharedrop-${new Date() |
| 147 | .toISOString() |
| 148 | .substring(0, 19) |
| 149 | .replace('T', '-')}.zip`, |
| 150 | { |
| 151 | type: 'application/zip', |
| 152 | }, |
| 153 | ); |
| 154 | }, |
| 155 | }); |
nothing calls this directly
no outgoing calls
no test coverage detected