# multer-sftp-linux

> SFTP storage engine for multer, for use on linux backend

Latest version **0.93.0** (published 2018-06-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install multer-sftp-linux
pnpm add multer-sftp-linux
yarn add multer-sftp-linux
bun add multer-sftp-linux
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.93.0 |
| Published | 2018-06-30 |
| First published | 2018-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Chun-Kai Wang |
| Maintainers | studentworks |
| Keywords | multer-sftp, express, multer, sftp, ssh |

## Links

- npm: https://www.npmjs.com/package/multer-sftp-linux
- Repository: https://github.com/chunkai1312/multer-sftp
- Homepage: https://github.com/chunkai1312/multer-sftp#readme
- Issues: https://github.com/chunkai1312/multer-sftp/issues
- npm.io page: https://npm.io/package/multer-sftp-linux

## Dependencies (1)

- [ssh2-sftp-client](https://npm.io/package/ssh2-sftp-client.md) ^1.1.0

## Recent versions

- 0.93.0 (latest) — 2018-06-30
- 0.92.0 — 2018-06-30
- 0.91.0 — 2018-06-30
- 0.9.0 — 2018-06-30
- 0.8.0 — 2018-06-30
- 0.7.0 — 2018-06-30
- 0.6.0 — 2018-06-30
- 0.5.0 — 2018-06-30
- 0.4.0 — 2018-06-30
- 0.3.0 — 2018-06-30
- 0.2.0 — 2018-06-30
- 0.1.0 — 2018-06-30

## README

# multer-sftp-linux

[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]

> SFTP storage engine for [Multer](https://github.com/expressjs/multer)
> Based entirle on multer-sftp but with added functionality for remote linux backends.

## Install

```
$ npm install --save multer-sftp-linux
```

## Usage

```js
var multer = require('multer')
var sftpStorage = require('multer-sftp-linux')

var storage = sftpStorage({
  sftp: {
    host: '127.0.0.1',
    port: 22,
    username: 'username',
    password: 'password'
  },
  destination: function (req, file, cb) {
    cb(null, '/tmp/my-uploads')
  },
  filename: function (req, file, cb) {
    cb(null, file.fieldname + '-' + Date.now())
  }
})

var upload = multer({ storage: storage })
```

## API

```js
var sftpStorage = require('multer-sftp')
```

### sftpStorage(opts)

The module returns a function that can be invoked with options to create a Multer storage engine.

#### opts

```js
{
  sftp: Object,
  destination: function (req, file, cb) { return cb(null, '/path/to/uploads') }
  filename: function (req, file, cb) { return cb(null, 'filename.ext') }
}
```

* `sftp`: **Required**. `sftp` is a settings object for sftp client connection. Please see [ssh2](https://github.com/mscdex/ssh2#user-content-client-methods) documentation for details.
* `destination`: **Required**. `destination` is used to determine within which folder the uploaded files should be stored. This can also be given as a `string` (e.g. `'/tmp/uploads'`).
* `filename`: **Optional**. `filename` is used to determine what the file should be named inside the folder. If no `filename` is given, each file will be given a random name that doesn't include any file extension.

## License

MIT © [Chun-Kai Wang](https://github.com/chunkai1312)

[npm-image]: https://img.shields.io/npm/v/multer-sftp.svg
[npm-url]: https://npmjs.org/package/multer-sftp
[travis-image]: https://img.shields.io/travis/chunkai1312/multer-sftp.svg
[travis-url]: https://travis-ci.org/chunkai1312/multer-sftp

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