
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
cordova-sftp-plugin
Advanced tools
Cordova plugin to Download/Upload files from/to a SFTP server.
This plugin is build on top of:
Contributors are welcome.
Platforms supported
cordova plugin add cordova-sftp-plugin
There is a base Object JJsftp
expose in window
that should be initialized with the host
, user
and password
for the server
var mySftp = new JJsftp("host", "user", "password");
download(serverPath, localPath [, createIfNotExists, successCallback, errorCallback])
Allow to download a single file.
serverPath
- Path/To/File/In/ServerlocalPath
- Path/To/File/In/DevicecreateIfNotExists
- Create the folder path if not existsuccessCallback
- Function to call in plugin successerrorCallback
- Function to call in plugin errordownloadList(list [, successCallback, errorCallback])
Allow to download a list of files
list
- Object array of files, has the follow attributes:
remote
- Path/To/File/In/Serverlocal
- Local/Path/To/Filecreate
] - default to: false
- Create the folder path if not existsuccessCallback
- Function to call in plugin successerrorCallback
- Function to call in plugin errorupload(serverPath, localPath [, successCallback, errorCallback])
Allow to download a single file.
serverPath
- Path/To/File/In/ServerlocalPath
- Path/To/File/In/DevicesuccessCallback
- Function to call in plugin successerrorCallback
- Function to call in plugin erroruploadList(list [, successCallback, errorCallback])
Allow to download a list of files
list
- Object array of files, has the follow attributes
remote
- Path/To/File/In/Serverlocal
- Local/Path/To/FilsuccessCallback
- Function to call in plugin successerrorCallback
- Function to call in plugin errorcancel([successCallback, errorCallback])
Allow to cancel the asyn process that make the connection
successCallback
- Function to call in plugin successerrorCallback
- Function to call in plugin errorEvery callback (success or error) will response for the action of add the elements downloads/upload list, if you wanna know when a file or all the files are donwloaded, you should listen to the events fires over document.
There are several events that fire during the process, all of it give one arg, the cordova event with few extra attributes
SFTPActionConnected(data)
- Fire on sftp channel connect
id
- string: UDID related to that connection (Android Only)SFTPActionStart(data)
- Fire when an action is about to start in a file
id
- string: UDID related to that connection (Android Only)from
- string : Path of the sourceto
- string : Path of the targetsize
- long : Size of the elementSFTPActionProgress(data)
- fire to inform the % of down/up load in the actual file
id
- string: UDID related to that connection (Android Only)percent
- int : % of actual file progressSFTPActionEnd(data)
- fire when the actual action over a file end
id
- string: UDID related to that connection (Android Only)SFTPActionListProgress(data)
- Fire after an action (Up/Down) is executed over a file, giving the actual file (index in list) and total files in list
id
- string: UDID related to that connection (Android Only)progress
- int : Actual element index in listtotal
- int : Total count of elements in listSFTPActionListEnd(data)
- Fire at end of action list to inform the # of file reach it
id
- string: UDID related to that connection (Android Only)all
- boolean : true if all action were made itSFTPActionDisconnected(data)
- Fire on sftp channel disconnect
id
- string: UDID related to that connection (Android Only)SFTPActionCancell(data)
- Fire on cancel async action
id
- string: UDID related to that connection (Android Only)To Download
var sftp = new JJsftp("host", "user", "password"),
localPath = "String/Path/To/Place/The/Download"
filelist = [{
remote : "/Path/To/Remote/File.*"
, local : localPath+"file.*"
},{
remote : "/Path/To/Another/Remote/File.*"
, local : localPath+"anotherFile.*"
}];
sftp.downloadList(filelist, function(data){
/* Wow everything goes good, but just in case verify data.success */
}, function(error){
/* Wow something goes wrong, check the error.message */
});
To Upload is the same but calling upload
or uploadList
and by default will override a file if exists in server
Of course if you want, you could add any of the JJsftp events to document and listen the progress of the download by example
upload
does not work on iOS (Yet)cancel
does not work on iOS (Yet), therefore SFTPActionCancell
is never trigger.FAQs
Cordova SFTP Upload And Download
The npm package cordova-sftp-plugin receives a total of 1 weekly downloads. As such, cordova-sftp-plugin popularity was classified as not popular.
We found that cordova-sftp-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.