Skip to content

Instantly share code, notes, and snippets.

@fritzy
Created July 2, 2014 04:37
Show Gist options
  • Save fritzy/d828d46b58378a9de444 to your computer and use it in GitHub Desktop.
Save fritzy/d828d46b58378a9de444 to your computer and use it in GitHub Desktop.
Writeable stream for saving into Dulcimer.
var util = require('util');
var stream = require('stream');
function WriteData() {
stream.Writeable.call(this, {highWaterMark: 20, objectMode: true});
}
util.inherits(WriteData, stream.Writeable);
WriteData.prototype._write = function (obj, _, next) {
SomeModel.create(obj);
SomeModel.save(next);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment