Fix electron file reading

Former-commit-id: 7db4f76d9b75787c5ae2d4af063c9ccec6082567 [formerly 3cb81126c551b29f6db9a2548c308982fe2f74b2 [formerly e4cb20724bd435b08d429e476019919f2792d0a9]]
Former-commit-id: b340a2557fa46aa850361d297b83712baabceba5
Former-commit-id: 2415c5e39288bd8ad60d99ca501344720a5f8df3
This commit is contained in:
Jaifroid 2020-10-25 14:10:28 +00:00
parent cebf88770e
commit 2ca1a16c93

View File

@ -203,7 +203,7 @@ define(['q'], function(Q) {
* @returns {Promise<Uint8Array>} A Promise for an array buffer with the read data * @returns {Promise<Uint8Array>} A Promise for an array buffer with the read data
*/ */
function readFileSlice(file, begin, end) { function readFileSlice(file, begin, end) {
if ('arrayBuffer' in Blob.prototype) { if (file.slice && 'arrayBuffer' in Blob.prototype) {
// DEV: This method uses the native arrayBuffer method of Blob, if available, as it eliminates // DEV: This method uses the native arrayBuffer method of Blob, if available, as it eliminates
// the need to use FileReader and set up event listeners; it also uses the method's native Promise // the need to use FileReader and set up event listeners; it also uses the method's native Promise
// rather than setting up potentially hundreds of new Q promises for small byte range reads // rather than setting up potentially hundreds of new Q promises for small byte range reads