React Native Expo: read/write external files - javascript

I wanted to know if/how it's possible to read/write non-app files with Expo. I specifically need to access files that fall outside of the app's directory, such as the downloads folder, images folder, and any other external folder. Expo docs on FileSystem say that it is only able to access app files, and not external files.

Related

Including source files in Cordova project from outside the project's directory hierarchy

tl;dr: I want to include some JavaScript files from another project in another directory into a Cordova project, without (manually) copying those files into my Cordova project directory tree. How?
I am editing an existing Cordova project that makes use of some JavaScript source files originally written for a large web application project.
Currently, I am adding these source files by copying them to a subdirectory of the Cordova project, and by adding a <script> tag with the relative path to an index.html file in the Cordova project. This causes the JavaScript files to integrated in the deployed app, apparently by virtue of Cordova's (or Ionic's?) magic.
Now, it would be preferrable for me to avoid copying the JavaScript files to my Cordova project directory. Instead, I would like to directly link to the files in their original location rather than copying them (so updates from the web application get automatically applied to the Cordova project, as well).
As both the Cordova project and the large web application reside in the same VCS repository, the relative path to the files will always be the same - for the sake of an example, like this:
|-repository/
|-web/
| |-src/
| |-myCode.js
|-cordova
|-src
|-index.html
|-helpers
|-myCode.js // copy of /repository/web/src/myCode.js
Therefore, I have tried setting the relative path in the aforementioned index.html file - but unfortunately, Cordova seems to take over that file verbatim, and thus, the resulting URL will not exist (prompting a 404 error in the console, and causing the code from the file to be unavailable).
How can I have Cordova include and reference files from outside the directory hierarchy of a Cordova project?
Is there maybe at least a way to have Ionic or Cordova automatically copy the files into the Cordova project directory upon building the app?

Storing Node.JS files Within a Meteor.JS Project

I have a meteor.js project directory (created from meteor create projectName) and I have some regular node.js .js files related to this site that only needs to be run using node fileName.js or using forver.
Is there a way to store these .js files within the Meteor project directory without it being auto-run (like how it will be executed if placed in the /server directory)?
And is it more advisable to place these .js files outside of the Meteor project directory?
Taking a look at the meteor documentation, you could probably use the private folder. This should stop auto-execution as well.
http://docs.meteor.com/#/full/structuringyourapp
private: All files inside a top-level directory called private are only accessible from server code and can be loaded via the Assets API. This can be used for private data files and any files that are in your project directory that you don't want to be accessible from the outside.

Install files to sdcard on Android/IOS with phonegap

I have some files that I need to copy to a folder once the user has installed my app. I was trying to find a way to transfer the files directly from the application root directory but no luck. I had also seen a suggestion about zipping the files and including the zipped file in my package, then extracting them to the folder. But did not know how to implement either methods.
Another alternative is to download and install the files when the app starts, but didnt want to rely on having to maintain the files on a server or that the user always has internet access since my app can be run offline.
How do I do this with a Phonegap/JQM/Javascript app?
Thanks,
Robert

Using cordova, can I use resolveLocalFileSystemURL to access a file that was in my build?

I'm building an app where I need to copy some pdfs that were inside my www folder to the shared device folder (FileEntry.toURL) but I'm not sure where to access these pdfs after my app is on the device.
If I use resolveLocalFileSystemURL, I can specify a file path and then copy that found file to the FileEntry.toURL() folder... but I'm not sure what that file path would be.
My file is located www/media/pdf/TestDocument.pdf - how do I access this file after I have done a build?
Use 1.2.0 of the file plugin. Then you should be able to use cordova.file.applicationDirectory to get at your bundle.

Phonegap: download resources from external server and start from downloaded file

I am planning to create a responsive website using jquery/backbonejs.
my plan is to create a simple webapp to be used in phonegap (and deployed to android and iPhone via appstore/Google Play) which does only check what resources are on the server (via JSON) and download them all. after downloading them, i would like to jump to the folder having all the downloaded files and start from there.
Since iam not allowed to download files directly into my phonegap app folder, i guess i need to download the files into some kind of document folder used by the app. But the question is, is it possible to redirect from my phonegaps index.html to that other index.html in my documents folder having all the downloaded files. would it work linking to jquery.js and images being in that folder located in js/ or img/ ?
That way i could keep my app up2date, but it loads only if there is something missing or updated on the server.

Categories