cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

android big file 60mb writeFile error

Open gurselk opened this issue 4 years ago • 10 comments

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

gurselk avatar May 20 '20 03:05 gurselk

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

breautek avatar May 20 '20 16:05 breautek

Code block for ionic 4

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

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

gurselk avatar May 20 '20 21:05 gurselk

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.

breautek avatar May 20 '20 23:05 breautek

i understand sorry Ekran Resmi 2020-05-21 04 01 11 Ekran Resmi 2020-05-21 04 03 08

gurselk avatar May 21 '20 01:05 gurselk

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.

breautek avatar May 21 '20 01:05 breautek

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/

gurselk avatar May 21 '20 01:05 gurselk

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

breautek avatar May 21 '20 01:05 breautek

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?

gurselk avatar May 21 '20 02:05 gurselk

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:

  • It provides us a provable scenario of a problem in Cordova, and eliminates any possibility that the problem is being caused by third-party code.
  • It can also be used to test solutions, to determine if a bug fix actually indeed fixes the problem.

breautek avatar May 21 '20 13:05 breautek

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

fb64 avatar Jun 03 '20 09:06 fb64