New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

larvitamsync

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvitamsync

Sync data between minions

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status Dependencies

larvitamsync

Sync data between minions

Usage

Server (data master)

For this to work, larvitamintercom must be configured and up and running!

const	options	= {'exchange': 'test_dataDump'}, // RabbitMQ exchange, must be unique on the queue
	amsync	= require('larvitamsync');

// The stdout from this command will be piped to the data slave
// This will be be the input for the
// https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
options.dataDumpCmd = {
	'command':	'cat',
	'args':	['/home/myself/dbdump.sql'],
	'options':	{}
};
// or
options.dataDumpCmd = {
	'command':	'mysqldump',
	'args':	['-u', 'root', '-psecret', '--single-transaction', 'dbname', 'table1', 'table2'],
	'options':	{}
};
// or something else

// Optional Content-Type header can be set like this:
options['Content-Type'] = 'application/sql';

// Returns https://nodejs.org/api/http.html#http_class_http_server
new amsync.SyncServer(options, function(err) {
	if (err) throw err;

	console.log('Server active');
});

Client (data slave)

For this to work, larvitamintercom must be configured and up and running!

const	options	= {'exchange': 'test_dataDump'}, // RabbitMQ exchange, must be unique on the queue
	amsync	= require('larvitamsync');

new amsync.SyncClient(options, function(err, res) {
	let	syncData	= '';

	if (err) throw err;

	// res is an instance of https://nodejs.org/api/http.html#http_class_http_incomingmessage

	res.on('data', function(chunk) {
		syncData += chunk.toString();
	});

	res.on('end', function() {
		console.log('Got sync data:');
		console.log(syncData);
	});

	res.on('error', function(err) {
		throw err;
	});
});
MariaDB/MySQL

For this to work, both larvitamintercom and larvitdb must be configured and up and running!

const	options	= {'exchange': 'test_dataDump'}, // RabbitMQ exchange, must be unique on the queue
	amsync	= require('larvitamsync');

amsync.mariadb(options, function(err) {
	if (err) throw err;

	console.log('Data synced!');
});

FAQs

Package last updated on 24 Dec 2016

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