@petitchevalroux/node-parallel-write-stream
Node write stream allowing to launch write on parallel
Last updated 4 years ago by petitchevalroux .
GPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @petitchevalroux/node-parallel-write-stream 
SYNC missed versions from official npm registry.

node-parallel-write-stream

Sample usage with MySQL

var writeStream = new require("@petitchevalroux/node-parallel-write-stream")({
    "concurrency": 4,
    "objectMode":true,
    "write":function(data, encoding, callback) {
        console.log(data);
        callback();
    }
});

var mysql = require('mysql');
var connection = mysql.createConnection({
    host: '<host>',
    user: '<user>',
    password: '<password>',
    database: '<database>'
});

connection.connect(function (err) {
    if (err) {
        console.error("error connecting: "" + err.stack);
        return;
    }
    readStream = connection.query("SELECT * FROM samples")
        .stream();
    readStream.on("end", function () {
        connection.destroy();
    });
    readStream.pipe(writeStream);
});

Current Tags

  • 1.0.1                                ...           latest (4 years ago)

2 Versions

  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (1)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |