# sftps

> SFTP client for node.js, wrapping the 'sftp' command

Latest version **0.2.8** (published 2015-06-17) · 0 weekly downloads

## Install

```sh
npm install sftps
pnpm add sftps
yarn add sftps
bun add sftps
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.8 |
| Published | 2015-06-17 |
| First published | 2015-06-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.4.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Sébastien Chopin |
| Maintainers | crispy1989 |
| Keywords | sftp, node-sftp |

## Links

- npm: https://www.npmjs.com/package/sftps
- Repository: https://github.com/zipscene/node-sftps
- Issues: https://github.com/zipscene/node-sftps/issues
- npm.io page: https://npm.io/package/sftps

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) >=1.4.4

## Recent versions

- 0.2.8 (latest) — 2015-06-17

## README

node-sftps
=========

SFTP client for node.js, mainly a `sftp` wrapper.

This is a fork of the `ftps` module.  This fork only supports sftp, and uses the `sftp` command instead of `lftp`.  This allows you to specify ssh-specific options such as private key file.

Requirements
------------

You need to have the executable `sftp` installed on your computer.
If you are using password authentication, you also need to have the `sshpass` utility installed.

Installation
-----------

``` sh
npm install sftps
```

Usage
-----

``` js
var SFTPS = require('sftps');
var sftp = new SFTPS({
  host: 'domain.com', // required
  username: 'Test', // required
  password: 'Test', // required
  port: 22 // optional
});
// Do some amazing things
sftp.cd('myDir').addFile(__dirname + '/test.txt').exec(console.log);
```

Some documentation
------------------

Here are chainable fonctions :

``` js
ftps.ls()
ftps.pwd()
ftps.cd(directory)
ftps.cat(pathToRemoteFiles)
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:
<pre>sftp.raw('ls -l')</pre>

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

Run the commands !
``` js
sftp.exec(function (err, res) {
  // err will be null (to respect async convention)
  // res is an hash with { error: stderr || null, data: stdout }
});
```

Also, take note that if a command fails it will not stop the next commands from executing, for example:
``` js
sftp.cd('non-existing-dir/').affFile('./test.txt').exec(console.log);
/*
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
*/

```

Why?
----

Just because I didn't found sftp and ftps module in node.js, it's pretty dirty to spawn `sftp` 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.

---
_Source: https://npm.io/package/sftps · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
