Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multer-sftp

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multer-sftp

SFTP storage engine for multer

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

multer-sftp

NPM version Build Status Coverage Status

SFTP storage engine for Multer

Install

$ npm install --save multer-sftp ssh2-sftp-client

Usage

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

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

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
{
  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 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

Keywords

FAQs

Package last updated on 25 Aug 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc