Files
game-server-watcher/node_modules/string-to-stream/index.js
Smith a5f3794527 include prod deps in vcs with some exceptions
* cloudno.de has problems installing new dependencies lately..
2022-06-30 22:59:51 +02:00

24 lines
513 B
JavaScript

module.exports = StringStream
var inherits = require('inherits')
var stream = require('readable-stream')
inherits(StringStream, stream.Readable)
function StringStream (str) {
if (!(this instanceof StringStream)) return new StringStream(str)
stream.Readable.call(this)
this._str = str
}
StringStream.prototype._read = function () {
if (!this.ended) {
var self = this
process.nextTick(function () {
self.push(new Buffer(self._str))
self.push(null)
})
this.ended = true
}
}