docker-stream-cleanser
Advanced tools
Comparing version 0.0.7 to 0.0.8
23
app.js
@@ -1,7 +0,2 @@ | ||
// Right now, we're just going to strip the headers that Docker sends. If we ever want a way | ||
// to color certain input, don't chop off the first byte | ||
// 8 (unicode) bytes at the beginning of each output | ||
module.exports = function(data, encoding) { | ||
module.exports = function(data, encoding, fixCarriageReturns) { | ||
if (!Buffer.isBuffer(data)) { | ||
@@ -21,2 +16,5 @@ data = new Buffer(data, encoding); | ||
if (payload === null) break; | ||
if (fixCarriageReturns) { | ||
payload = payload.replace(/\r?\n/g, '\r\n'); | ||
} | ||
result += payload.toString(); | ||
@@ -27,3 +25,11 @@ } | ||
module.exports.cleanStreams = function (buildStream, clientStream, encoding) { | ||
/** | ||
* This takes data from an input stream, strips out the payload, then writes that payload | ||
* to the output stream | ||
* @param buildStream input stream | ||
* @param clientStream output stream | ||
* @param encoding encoding of the stream | ||
* @param fixCarriageReturns replaces all of the extra carriage returns with only one | ||
*/ | ||
module.exports.cleanStreams = function (buildStream, clientStream, encoding, fixCarriageReturns) { | ||
buildStream.on('data', function(data) { | ||
@@ -45,2 +51,5 @@ if (!Buffer.isBuffer(data)) { | ||
if (payload === null) break; | ||
if (fixCarriageReturns) { | ||
payload = payload.replace(/\r?\n/g, '\r\n'); | ||
} | ||
clientStream.write(payload.toString()); | ||
@@ -47,0 +56,0 @@ } |
{ | ||
"name": "docker-stream-cleanser", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"main": "app.js", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
59539
126