Created
July 2, 2014 04:37
-
-
Save fritzy/d828d46b58378a9de444 to your computer and use it in GitHub Desktop.
Writeable stream for saving into Dulcimer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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