Cannot use FileTransfer plugin


#1

I have an ionic 2 project set up with TypeScript. I have typed npm install ionic-native --save then ionic plugin add cordova-plugin-camera.

I can import the camera plugin import {Camera} from 'ionic-native'; in one of my pages and also use it without a problem.
Now I want to send that file to a server. For this I’m trying to use the FileTransfer plugin. So I did the ionic plugin add cordova-plugin-file-transfer which gave the following output:

Fetching plugin "cordova-plugin-file-transfer" via npm
Installing "cordova-plugin-file-transfer" for android
Fetching plugin "cordova-plugin-file" via npm
Installing "cordova-plugin-file" for android
Dependent plugin "cordova-plugin-compat" already installed on android.

The Android Persistent storage location now defaults to "Internal". Please check this plugins README to see if you application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:

      "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.


Saving plugin to package.json file

When I now try to import {FileTransfer} from 'ionic-native'; my IDE (Atom) gives me an error: “node_modules/ionic-native/dist/index has no exported member FileTransfer”

And when I look into the package.json, there is nothing named filetransfer or antyhing like that.

What is going wrong here?


#2

I believe ionic-native calls it just Transfer, not FileTransfer.


#3

Thank you, I did some digging and came to that conclusion before I’ve read your response.