Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
SSH and SFTP tasks for gulp
Install with npm
npm install --save-dev gulp-ssh
'use strict'
var fs = require('fs');
var gulp = require('gulp')
var GulpSSH = require('gulp-ssh')
var config = {
host: '192.168.0.21',
port: 22,
username: 'iojs',
privateKey: fs.readFileSync('/Users/zensh/.ssh/id_rsa')
}
var gulpSSH = new GulpSSH({
ignoreErrors: false,
sshConfig: config
})
gulp.task('exec', function () {
return gulpSSH
.exec(['uptime', 'ls -a', 'pwd'], {filePath: 'commands.log'})
.pipe(gulp.dest('logs'))
})
gulp.task('dest', function () {
return gulp
.src(['./**/*.js', '!**/node_modules/**'])
.pipe(gulpSSH.dest('/home/iojs/test/gulp-ssh/'))
})
gulp.task('sftp-read', function () {
return gulpSSH.sftp('read', '/home/iojs/test/gulp-ssh/index.js', {filePath: 'index.js'})
.pipe(gulp.dest('logs'))
})
gulp.task('sftp-write', function () {
return gulp.src('index.js')
.pipe(gulpSSH.sftp('write', '/home/iojs/test/gulp-ssh/test.js'))
})
gulp.task('shell', function () {
return gulpSSH
.shell(['cd /home/iojs/test/thunks', 'git pull', 'npm install', 'npm update', 'npm test'], {filePath: 'shell.log'})
.pipe(gulp.dest('logs'))
})
var GulpSSH = require('gulp-ssh')
var gulpSSH = new GulpSSH(options)
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)
gulp - gulp
instance.
Type: Boolean
Ignore errors when executing commands. Default: (false)
return stream
, there is a event "ssh2Data" on stream that emit ssh2 stream's chunk.
Required
Type: String
or Array
Option
Type: String
file path to write on local. Default: ('gulp-ssh.shell.log')
Option
Type: Boolean
auto exit shell. Default: (true)
return stream
, there is a event "ssh2Data" on stream that emit ssh2 stream's chunk.
Required
Type: String
or Array
Option
Type: String
file path to write on local. Default: ('gulp-ssh.exec.log')
return stream
Required
Type: String
Value: 'read' or 'write'
Required
Type: String
file path to read or write on server. Default: (none)
Option
Type: Object
return stream
, copy the files to remote through sftp, acts similarly to Gulp dest, will make dirs if not exist.
Close the ssh connection.
MIT © Teambition
FAQs
SSH and SFTP tasks for gulp
The npm package gulp-ssh receives a total of 5,578 weekly downloads. As such, gulp-ssh popularity was classified as popular.
We found that gulp-ssh demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.