Closed Kohys58 closed 3 months ago
If anyone sees this, it was not caused by something related to the docx lib in itself, I just changed my way of managing the readFile and writeFile from the react-native-blob-util library.
Instead i'm using readStream and writeStream, which fixes the issue.
Hello,
I've been working on this for days now and I can't figure out a way of achieving my goal here.
react-native : 0.72.6 docx : 8.5.0 react-native-blob-util : 0.19.10
Initially I was generating the whole document (with the 100 images) directly in the new Document() constructor, but I had this issue where the app would close itself after a while, usually up to an hour.
So I tried doing it with the patchDocument method (with the 100 images at once), still had the same issue.
Then I tried to process it with "batches", so that It would free some memory after each operation, but even if I have let's say a batch size of 1 and that I write the document each time a new image is proccessed, it takes even more time (few hours), and the app still close itself at some point.
At each iteration the console.log() takes more time to print, which I believe is logical since the document is getting bigger each time.
The App close "bug" usually happens (no matter the batch size), after around 30 images have been processed, it prints my "RAPPORT LOADING..." log, then App close itself (no error message).
I thought of using some multi threading library to deal with it, but unfortunately none of them has been updated with the react native version that i'm using (0.72.6), plus, i'm not sure if this type of computation can be done in a parallel thread.
This is a soon to be production App and I have no idea on how to handle this issue. Help needed.
Here are my utilities functions :