Closed jfoclpf closed 3 months ago
If it's erroring at the FileReader
level, you may not be seeing the result because you're only hooking the onerror
callback after the readAs*
call.
Otherwise it will be good to include the error, if any.
I don't think it's related, but you resolve during onloadend
but also reject in onerror
. This is a problem because on error, both will be called and you are going to try to resolve or reject a a promise that already has an resolution. Instead of onloadend
, you can use onload
instead which will only fire on successful, which should guarantee that you resolve/reject the promise only once.
Otherwise, I don't see any a problem code wise.
Thank you very much @breautek
If it's erroring at the
FileReader
level, you may not be seeing the result because you're only hooking theonerror
callback after thereadAs*
call.
Should I then declare the reader.onerror
before the readAs*
call? Interesting, I will do it
I don't think it's related, but you resolve during
onloadend
but also reject inonerror
. This is a problem because on error, both will be called and you are going to try to resolve or reject a a promise that already has an resolution. Instead ofonloadend
, you can useonload
instead which will only fire on successful, which should guarantee that you resolve/reject the promise only once.
Thank you very much, it makes sense, I will amend onloadend
to onload
It seems that the discussion has reached a resolution. If the issue has been resolved, could you please close the ticket?
thanks for all the support and great work
The files seem to load correctly from www folder when the app is run in emulator, but not when run from the device (iPhone SE 1gen).
Any possible hint why this is happening?
I am reading like this
where
readFile
isAny help will be highly appreciated Thanks