JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1871
  • Score
    100M100P100Q112893F
  • License MIT

SSH and SFTP tasks for gulp

Package Exports

  • gulp-ssh

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-ssh) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-ssh v0.3.0

SSH and SFTP tasks for gulp

Install

Install with npm

npm install --save-dev gulp-ssh

Example

var gulp = require('gulp');
var gulpSSH = require('gulp-ssh')({
  ignoreErrors: false,
  sshConfig: {
    host: 'angularjs.cn',
    port: 22,
    username: 'root',
    privateKey: require('fs').readFileSync('/Users/zensh/.ssh/id_rsa')
  }
});

// execute commands
gulp.task('exec', function () {
  return gulpSSH
    .exec(['uptime', 'ls -a', 'pwd'], {filePath: 'commands.log'})
    .pipe(gulp.dest('logs'));
});

// get file from server and write to local
gulp.task('sftp-read', function () {
  return gulpSSH.sftp('read', 'pm2.json')
    .pipe(gulp.dest(''));
});

// put local file to server
gulp.task('sftp-write', function () {
  return gulp.src('index.js')
    .pipe(gulpSSH.sftp('write', 'test.js'));
});

// execute commands in shell
gulp.task('shell', function () {
  return gulpSSH
    .shell(['cd /home/thunks', 'git pull', 'npm install', 'npm update', 'npm test'], {filePath: 'shell.log'})
    .pipe(gulp.dest('logs'));
});

API

var GulpSSH = require('gulp-ssh');

GulpSSH(options)

var gulpSSH = new GulpSSH(options);

options.sshConfig

Required Type: Object

  • host - String - Hostname or IP address of the server. Default: 'localhost'

  • port - Number - Port number of the server. Default: 22

  • username - String - Username for authentication. Default: (none)

  • password - String - Password for password-based user authentication. Default: (none)

  • privateKey - String or Buffer - Buffer or string that contains a private key for key-based user authentication (OpenSSH format). Default: (none)

More SSH Connection methods

options.ignoreErrors

Type: Boolean

Ignore errors when executing commands.. Default: (false)


gulpSSH.connect(sshConfig)

return gulpSSH

gulpSSH.shell(commands, options)

return stream

commands

Required Type: String or Array

options.filePath

Option Type: String

file path to write on local. Default: ('gulp-ssh.shell.log')

gulpSSH.exec(commands, options)

return stream

commands

Required Type: String or Array

options.filePath

Option Type: String

file path to write on local. Default: ('gulp-ssh.exec.log')

gulpSSH.sftp(command, filePath, options)

return stream

command

Required Type: String Value: 'read' or 'write'

filePath

Required Type: String

file path to read or write on server. Default: (none)

options

Option Type: Object

License

MIT © Teambition