title: PhoneGap - Read pre-packaged sqlite database
body: <p>I've been struggling to get this working for too long. I just started to get into PhoneGap/Cordova. I got the demo app running, installed all official plugins, and added this SQLite plugin to begin work with: <a href="https://github.com/brodysoft/Cordova-SQLitePlugin" rel="nofollow">https://github.com/brodysoft/Cordova-SQLitePlugin</a></p>
  
  <p>However, I want the plugin to read a pre-packaged database. Simply put, create an app that works offline and does not need to download an SQLite database when it is run for the first time.</p>
  
  <p>I have been developing for Android for quite some time, and the solution was to deploy a read-only database file in the assets folder, and on first run copy the database file into a different folder, where I can read/write as I please.</p>
  
  <p>So I did a little research and realized that it SHOULD be the same with PhoneGap. Place a binary SQLite database somewhere, so that when built, it will be packaged with the app. And then simply load it with the SQLite plugin I linked here.</p>
  
  <p>Finally, the question! What are the exact steps I have to take to be able to read a file that was packaged with the app?</p>
  
  <ol>
  <li>Where should I put my binary file to ensure that it gets packaged into the app?</li>
  <li>How exactly should I initialize the File API? Should I ask for persistent storage using <code>window.requestFileSystem</code>? Or should I get some (not sure which) directory (<code>cordova.file.applicationDirectory</code>) as a <code>DirectoryEntry</code> using <code>window.resolveLocalFileSystemURL</code>? If so, what are the EXACT parameters I should use? I am mostly referring to this: <a href="https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md" rel="nofollow">https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md</a></li>
  <li>How do I read the packaged file? Using <code>window.resolveLocalFileSystemURL</code> with the right folder? What should then the parameters be?</li>
  <li>File copying should work OK if I get to this point. Just copy from the read-only <code>cordova.file.applicationDirectory</code> into <code>cordova.file.dataDirectory</code>, which is read/write. Right?</li>
  </ol>
  
  <p>I know the questions might be pretty basic, but my countless attempts were unsuccessful and I did not find a tutorial that explains this in-depth (believe me, I googled). Also, the documentation seems insufficient.</p>
  
  <p>Just working with a WebSQL database and load data the DB using a s***load of <code>INSERT</code>s is not a viable option, the database has thousands of records.</p>
  
  <p>Thanks for the help in advance, you will save me a headache or two.</p>