I have a problem with the FTP plugin (http://ionicframework.com/docs/native/ftp/). I want to download a series of files from an FTP one by one and once a file is downloaded the application should read the file and insert the data into a database. The problem is that the application reads the file before it is downloaded 100% and I do not know how to fix it.
According to the documentation, the download percentage is returned, but I do not know how to launch the function once it reaches 100%.
@GabberMan did you manage to get this to work? I did the same way but the progress seems to only fire once. But the file got downloaded. Uploads give the same result too.
As a workaround I am using an interval to check if the downloaded file is written to storage. However, I canāt use the same interval to check for uploads.
Hello, I finally did the most horrible thing I could do⦠I set a waiting time to āwaitā for the document to be downloaded, I could not find any solution.
@GabberMan I did the same way too but I needed to upload and that didnāt work.
By the way, it seems to be an issue with Ionic typescript / angular version of the plugin. The upload function returns a promise but an observable is more appropriate. I used this one here which works - https://github.com/olaferlandsen/cordova-plugin-ftp
Hello, Iām facing the same issue but with upload, as what @arsyad said this is an issue with the native plugin itself, shouldnāt we need to post an issue?
Returns: Promise<any> Returns a promise. It will be triggered many times according the fileās size. The arg 0, 0.1xx, 0.2xx ⦠1 means the upload percent. When it reach 1, means success.
It is triggered multiple times, so I guess you could try an if statement in your the functionā¦
But on the other hand I donāt know wether a promise could be triggered multiple times⦠it thought when its done the the state couldnāt be canged anymore?
Hello user5555, the if statement does not work, and I do not know what it means to say that the promise could be activated several times⦠once you get the āthenā return, the value does not change.