Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13044

Update cordova-plugin-file to latest version of File API

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • cordova-plugin-file

    Description

      Part of the roadmap for the core plugins is to update them to make them spec-relevant once more. See CB-12715.
      After taking a look at the current version of W3C File API, here is one take on what specific API changes are needed to update the API to the current version:

      • remove a bunch of APIs, specifically:
      • update a bunch of APIs, specifically:
        • update FileReader interface's readAs* methods so that they take a Blob object instead of a File object as parameter
        • if the polyfill is still needed, might need to update the File object and remove a bunch of extra native-y cruft like "type" and stuff that was used when leveraging the bridge
        • update any error handling to return DOMException instances instead of the now-removed FileError
      • possibly write up a polyfill for Blob ? Looks like it will be needed in Android 4.4 or lower.
      • possibly write up a polyfill for FileList (as per spec) - might be needed on iOS 9.3 / Android 4.4. Worth noting that the first descriptive text in the spec mentions this interface being "at risk" as it's basically a glorified array.
      • review docs:

      A few open questions:
      1. One thing worth noting is that platform implementations for a lot of the above may not be needed on iOS 10+ and Android 5.0+. Would need to check windows / edge support. If support is splotchy, we need to keep in mind to write the plugin in such a way that we don't clobber over potentially-pre-existing spec-adhering objects of the File API.
      2. Worth calling out that the File API defines its own URL scheme to use. Does this then supercede the cordova custom ones like cdvfile:// and other protocols?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              filmaj Filip Maj
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: