apache / cordova-plugin-file

Apache Cordova File Plugin
https://cordova.apache.org/
Apache License 2.0
741 stars 756 forks source link

android big file 60mb writeFile error #391

Open gurselk opened 4 years ago

gurselk commented 4 years ago

Bug Report

Problem

android big file 60mb writeFile error ios not problem perfect working

What is expected to happen?

not write error problem

Ekran Resmi 2020-05-20 07 23 44 Ekran Resmi 2020-05-20 07 24 38
breautek commented 4 years ago

What's the DOMException that is cut off in the screenshot?

gurselk commented 4 years ago

Code block for ionic 4

https://ionicframework.com/docs/native/file

What's the DOMException that is cut off in the screenshot?

breautek commented 4 years ago

That doesn't answer my question.

Inside the web inspector, I see that the FileReader object (event.target) has an error property. That error property has a DOMException. But the full error text is cut off. We need to know what that DOMException is.

gurselk commented 4 years ago

i understand sorry

Ekran Resmi 2020-05-21 04 01 11 Ekran Resmi 2020-05-21 04 03 08
breautek commented 4 years ago

Hmm, the error is kinda strange.

I think usually you see that if:

But it looks like you're trying to write to the application storage directory and I think apps implicitly have permission to that directory, and it looks like you're writing to the root data directory, and that should automatically exists.

Are you able to provide a sample test app that demonstrates this issue? Please only include the core cordova libraries (ie no frameworks like ionic). You can learn how to create a sample app here.

gurselk commented 4 years ago

Hmm, the error is kinda strange.

I think usually you see that if:

  • The directory you're writing to does not exists
  • Lack permissions to write to the directory

But it looks like you're trying to write to the application storage directory and I think apps implicitly have permission to that directory, and it looks like you're writing to the root data directory, and that should automatically exists.

Are you able to provide a sample test app that demonstrates this issue? Please only include the core cordova libraries (ie no frameworks like ionic). You can learn how to create a sample app here.

4-5 mb below easily writes our problem is not to write large files and errors

i found an article about this but i can't apply it to my project :(

https://www.reddit.com/r/cordova/comments/7qwfxo/need_help_readingwriting_large_files_100mb/dxagj63/

breautek commented 4 years ago

4-5 mb below easily writes our problem is not to write large files and errors

Hmm, in my apps I frequently write large amounts of data, on average 10-20mb, but I've seen datasets over 100mb. One difference between my app and your app is I write JSON data as a string. It looks like you're writing a blob. These data types could be handled differently. Another important difference is I'm not using the ionic framework.

This is where a pure cordova sample project becomes useful. To eliminate the possibility that the problematic code is outside of Cordova's control, and to also pinpoint exactly what the problem is.

If the problem is specifcally writing large files, we can quickly generate a large file by using the fsutil file createnew output.dat 60000000 command on windows (requires the administrator console).

Or on linux: dd if=/dev/zero of=output.dat bs=60M count=1

Or on mac: dd if=/dev/zero of=output.dat bs=1m count=60

gurselk commented 4 years ago

4-5 mb below easily writes our problem is not to write large files and errors

Hmm, in my apps I frequently write large amounts of data, on average 10-20mb, but I've seen datasets over 100mb. One difference between my app and your app is I write JSON data as a string. It looks like you're writing a blob. These data types could be handled differently. Another important difference is I'm not using the ionic framework.

This is where a pure cordova sample project becomes useful. To eliminate the possibility that the problematic code is outside of Cordova's control, and to also pinpoint exactly what the problem is.

If the problem is specifcally writing large files, we can quickly generate a large file by using the fsutil file createnew output.dat 60000000 command on windows (requires the administrator console).

Or on linux: dd if=/dev/zero of=output.dat bs=60M count=1

Or on mac: dd if=/dev/zero of=output.dat bs=1m count=60

My information is quite insufficient. Could you offer me a solution for ionic?

breautek commented 4 years ago

Could you offer me a solution for ionic?

No, if you're looking for ionic-specific support, a better place to ask is through ionic's support channels. Most of our cordova maintainer's have much knowledge about third-party frameworks like ionic to give proper answers, and even if they did, the Cordova channels are not the right place for ionic questions or bug reporting.

This is why I'm asking a reproduction app without the use of frameworks. This serves a few different purposes:

fb64 commented 3 years ago

I have a similar problem on iOS when writing file of 90Mb. Webview restart whithout any error trace before end of writing. Using https://gist.github.com/M3psipax/027ca0df737800163f54a771862c1310 (with arraybuffer instead blob) fix the error for me