cordova plugin for sftp works on both:
- IOS
- Android
npm install ionic-native-sftp-leapfroggr --save
cordova plugin add cordova-plugin-sftp-leapfroggr
- required dependencies
-
- uses NMSSH library for sftp operations
- https://github.com/NMSSH/NMSSH
pod 'NMSSH'
-
- uses JSch library
- http://www.jcraft.com/jsch/
- coded in kotlin
- add library dependencies to app gradle
compile group: 'com.jcraft', name: 'jsch', version: '0.1.54' compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.31"
- configure sftp
this.sftp_provider.configureSFTP({
host: <host>,
username: <username>,
password: <password>,
destination_folder: <destination folder>
}).then(() => {
console.log("configured")
})
- upload
this.sftp_provider.upload({filename, filepath}).then(() => {
observer.next("complete")
observer.complete()
}).catch(error => {
observer.error(error)
})
- directory operation
- list
- delete files
- download files