Giter Site home page Giter Site logo

akeebabackup-nodejs's Introduction

AkeebaBackup module for NodeJS

This module lets you easily use the AkeebaBackup JSON APIs in node.js. AkeebaBackup (http://www.akeebabackup.com) is THE backup software for Joomla! As of version 0.1.0, it supports only the raw encryption, but in the future, if needed, the other encryption system supported by the apis will be added.

Installation

Using npm:

npm install akeebabackup

You can also clone this repository into your node_modules directory.

Examples

Trigger a Backup

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	yoursite.backup();
	yoursite.on('completed', function(data){console.log('backup completed')});
} catch(e) {
	console.log(e);
}

Available methods

Here you'll be able to see a list of methods available in the akeebabackup module, such as:

backup

Trigger a new backup

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	yoursite.backup();
	
	yoursite.on('started', function(data){
		console.log('backup started');
	});
	yoursite.on('step', function(data){
		console.log('backup has completed a step');
	});
	yoursite.on('completed', function(data){
		console.log('backup completed');
	});
} catch(e) {
	console.log(e);
}

srp

Trigger a System Restore Point backup for an extension

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.srp('name', 'type', ['group']); 
	yoursite.srp('akeeba', 'component');
	
	yoursite.on('started', function(data){
		console.log('srp started');
	});
	yoursite.on('step', function(data){
		console.log('srp has completed a step');
	});
	yoursite.on('completed', function(data){
		console.log('srp completed');
	});
} catch(e) {
	console.log(e);
}

delete

Completely removes a backup record from the database. Unlike deleteFiles, it will delete the files corresponding to the given backup record and the backup record itself. The Akeeba Backup component will not be aware that the specified backup record ever existed.

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.delete(id, callback)
	yoursite.delete(42, function(result){

	});
} catch(e) {
	console.log(e);
}

deleteFiles

Remove only the files corresponding to a given backup record, but not the backup record itself. The Akeeba Backup component will display this backup record marked as "obsolete"

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.deleteFiles(id, callback)
	yoursite.deleteFiles(42, function(result){

	});
} catch(e) {
	console.log(e);
}

download

Download (step by step) a backup file to a file

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.download(id, file)
	yoursite.download(42, 'yourbackup.jpa');

	yoursite.on('completed', function(){
		console.log('File saved');
	});
} catch(e) {
	console.log(e);
}

downloadDirect

Download a file directly, without encryption and step by step download

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.downloadDirect(id, file)
	yoursite.downloadDirect(42, 'yourbackup.jpa');

	yoursite.on('completed', function(){
		console.log('File saved');
	});
} catch(e) {
	console.log(e);
}

getBackupInfo

Gets detailed information about a specific backup record.

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.getBackupInfo(id, callback)
	yoursite.getBackupInfo(42, function(data){
		console.log(data);
	});
} catch(e) {
	console.log(e);
}

getLog

Downloads The log file for a specific backup tag

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.getLog(tag, file)
	yoursite.getLog('remote', 'log.txt');

	yoursite.on('completed', function(){
		console.log('Log saved');
	});
} catch(e) {
	console.log(e);
}

getProfiles

Returns a list of the backup profiles. The callback receives an array:

	[{id, name}]
var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.getProfiles(callback)
	yoursite.getProfiles(function(data){
		console.log(data);
	});
} catch(e) {
	console.log(e);
}

getVersion

Returns the version number of the API and the component. The callback receives an object:

	{api, component, date, edition, updateinfo}
var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.getVersion(callback)
	yoursite.getVersion(function(data){
		console.log(data);
	});
} catch(e) {
	console.log(e);
}

listBackups

Returns a (partial) list of the backup records known to the component. The records are presented in reverse order, i.e. the first record is the last backup attempt, whereas the last record is the earliest backup attempt known to the component.

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.listBackups(callback, start, limit)
	yoursite.listBackups(function(data){
		console.log(data);
	}, 0, 50);
} catch(e) {
	console.log(e);
}

update

Triggers the entire akeeba update process

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	yoursite.update();

	yoursite.on('step', function(){
		console.log('step completed');
	});
	yoursite.on('completed', function(){
		console.log('update completed');
	});
} catch(e) {
	console.log(e);
}

updateGetInformation

Returns update status information, as returned by Live Update itself

var akeeba = require('akeebabackup');
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');

try {
	// yoursite.updateGetInformation(callback, force_fetch_new_data)
	yoursite.updateGetInformation(function(data){
		console.log(data);
	}, true);
} catch(e) {
	console.log(e);
}

akeebabackup-nodejs's People

Contributors

skullbock avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.