Stuck at using ionic 2 native file


I’m a bit confused using Ionic 2’s native file plugin. I could get a picture taken from a camera, then I want to access the picture using Ionic 2’s file class. I tried the code below but it didn’t work, nor did it tell me what exactly the error was. I want to clarify: 1) do I need to do ionic plugin add cordova-plugin-file before using the native file plugin? 2) how to read a file uri?

takePicture() {
          destinationType: Camera.DestinationType.FILE_URI,
          saveToPhotoAlbum: true,
          allowEdit: false
      }).then((imageURI) => {
          // imageData is a base64 encoded string
          this.imageURI = imageURI;
          var imagePath = imageURI.substr(0, imageURI.lastIndexOf('/') + 1);
          var imageName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
          var imagePath = this.appDir + imageName;

          File.readAsDataURL(this.imagePath, imageName)
              .then(function (base64Img) {
              .catch(function (err: TypeError) {
      }, (err) => {
1 Like

DId you ever get this fixed? Im about to embark on the same thing.