Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

readme.md

Support Donate

Simple module for backing up files to remote server over sftp (ssh)

## Installation

  • download the module sshbackup.js
  • add it into the modules in your application directory
/your-application-directory/modules/sshbackup.js

Install ssh2 module from npm using npm install ssh2

Initialization

Paste the code bellow to some definition file.

	MODULE('ssh-backup').init({
		host: '1.2.3.4',
		port: 22,
		username: 'username',
		password: 'password'
	});

	// or using privateKey

	MODULE('ssh-backup').init({
		host: '1.2.3.4',
		port: 22,
		username: 'username',
		privateKey: require('fs').readFileSync('/path/to/the/key')
	});

Usage

	var source = '/local/path/to/the/file.json';
	var dest = '/remote/path/to/the/file.json';

	MODULE('ssh-backup').backup(source, dest, function(err){
		console.log('DONE', err);
	});