Changing Source files with File Transfer

Suppose i want to change one of the source files:

src/pages/test/test.ts.

I made a ‘Download’ button that downloads the file. Now what directory to place the file in so that the change is made to app? That is where i am stuck. cordova.applicationDirectory is read only so i cannot place the file directly there.
Is there any workaround ? Like opening the downloaded file and copying its content to source file or something like updating source file by fetching data from downloaded file.