FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.

npm install ftps
2 downloads in the last day
32 downloads in the last week
78 downloads in the last month


FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.


You need to have the executable lftp installed on your computer.


npm install ftps


```` js var FTPS = require('ftps'); var ftps = new FTPS({ host: 'domain.com', // required username: 'Test', // required password: 'Test', // required protocol: 'sftp', // optional, values : 'ftp', 'sftp', 'ftps',... default is 'ftp' // protocol is added on beginning of host, ex : sftp://domain.com in this case }); // Do some amazing things ftps.cd('myDir').addFile(__dirname + '/test.txt').exec(console.log);

Some documentation

Here are chainable fonctions :

``` js
ftps.put(pathToLocalFile, [pathToRemoteFile]) // alias: addFile
ftps.get(pathToRemoteFile, [pathToLocalFile]) // download remote file and save to local path (if not given, use same name as remote file), alias: getFile
ftps.mv(from, to) // alias move
ftps.rm(file1, file2, ...) // alias remove

Execute a command on the remote server:

ftps.raw('ls -l')
To see all available commands -> http://lftp.yar.ru/lftp-man.html

For information, ls, pwd, ... rm are just some alias of raw() method.

Run the commands !

ftps.exec(function (err, res) {
  // err will be null (to respect async convention)
  // res is an hash with { error: stderr || null, data: stdout }

For information, if somes commands fails, it will don't stop the next commands, example:

Will add file on ~/ and give:
  error: 'cd: non-existing-dir: No such file or directory\n',
  data: ''
So...be cautious because ./test.txt has been added


Just because I didn't found sftp and ftps module in node.js, it's pretty dirty to spawn lftp command, but sorry, it does the work for me, maybe for you too :) Ah and sorry for tests, it's a hack, so I just do some manual tests.

npm loves you