var blob = this .file.slice( this .readed, this .readed + this .step); this .reader.readAsArrayBuffer(blob);
Solution:
When the reader reads, first judge the readyState value, and then execute the reading if it is not loading.
if (this.reader.readyState == 1) return ; var blob = this .file.slice( this .readed, this .readed + this .step); this .reader.readAsArrayBuffer(blob);
readyState
FileReader
value | condition | describe |
---|---|---|
0 |
EMPTY |
Reader has been created. No read methods have been called yet. |
1 |
LOADING |
The read method has been called. |
2 |
DONE |
The operation is complete. |
EMPTY
- Created, but the readAs method has not yet been called .
FileReader
LOADING
- The readAs method is called. An or is being read , but an error has not yet occurred.
File
Blob
DONE
- The read operation is complete. This could mean: the whole or was read into memory, a file read error occurred, or the read was canceled when called.
File
Blob
abort()
var reader = new FileReader(); console.log( 'EMPTY', reader.readyState); // readyState will be 0 reader.readAsText(blob); console.log( 'LOADING', reader.readyState); // readyState will be 1 reader.onloadend = function () { console.log( 'DONE', reader.readyState); // readyState will be 2 };
Similar Posts:
- [Solved] Changing the selected file Error when uploading excel file. Net:: err_UPLOAD_FILE_CHANGED
- error – canvas- Failed to execute ‘toBlob’ on ‘HTMLCanvasElement’: Tainted canvases may not be exported.
- How to Use Array.prototype.slice.call(arguments)
- [Solved] An error occurred when paddlepaddle iterated data: typeerror: ‘function’ object is not iterative
- python csv error: line contains null byte [How to Solve]
- The applet reports an error thirdscripterror DateValue is not defined;
- BeanShell error: error invoking BSH method: Eval [How to Solve]
- AttributeError: ‘_csv.reader’ object has no attribute ‘next’ [How to Solve]
- Always report uncaught error:[$ injector:modulerr ]Solutions to errors
- Sublime text install Emmet (Zen coding) plug in