cordova-sqlite-storage-file

0.0.1 • Public • Published

cordova-sqlite-storage-file

Resolves SQLite database path similar to cordova-sqlite-storage

with initial implementation on iOS & macOS ("osx") with a temporary and deprecated location: 2 setting needed, intended for some urgent testing purposes, until default LocalDatabase support is added as a TODO item

License: MIT

General motivations

  • an application could use this plugin to get the absolute path which is needed to form ATTACH and DETACH statements
  • supports file-based db files for new SQLite plugin in progress (brodybits/ask-me-anything#3)

Sample code

For Android only:

document.addEventListener('deviceready', function () {
  window.sqliteStorageFile.resolveAbsolutePath({
    name: 'sample.db',
    location: 'default'
  }, function (result) {
    console.log('absolute path: ' + result)
  }, function (e) {
    console.log('ERROR: ' + e.message)
  })
})

needed for iOS - store in Library for now:

document.addEventListener('deviceready', function () {
  window.sqliteStorageFile.resolveAbsolutePath({
    name: 'sample.db',
    // TEMPORARY & DEPRECATED - store in Library for iOS:
    location: 2
  }, function (result) {
    console.log('absolute path: ' + result)
  }, function (e) {
    console.log('ERROR: ' + e.message)
  })
})

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i cordova-sqlite-storage-file

      Weekly Downloads

      3

      Version

      0.0.1

      License

      MIT

      Unpacked Size

      9.32 kB

      Total Files

      13

      Last publish

      Collaborators

      • brodybits