Node.js implementation of mysqldump
utility based on Readable
stream.
npm install mysqldump-stream
var Mysqldump = require('mysqldump-stream');
var mysqldump = new Mysqldump('mydatabase', {
gzip: true, //default: false
host: 'localhost', //default
port: 3306, //default
user: 'root', //default: process.env.USER || 'root'
password: 'mypassword' //default: false
});
var fs = require('fs');
mysqldump.start();
mysqldump.pipe(fs.createWriteStream('./mydatabase.sql.gz'));