apocas / docker-modem

Docker Remote API network stack driver.
Apache License 2.0
234 stars 112 forks source link

add a endCallback for demuxStream #96

Closed avengerandy closed 5 years ago

avengerandy commented 6 years ago

hi, i use your dockerode in my project it really awesome! i use it control docker to run code safety like a sandbox so i use exec frequently but in example i cant find the way to get the exec result i find other people have same demand https://github.com/apocas/dockerode/issues/401 then you reply "could just listen for the data and end stream events." and solve my problem, my code is like

var newStream = require('stream');
var logStream = new newStream.PassThrough();
logStream.on('data', function(chunk){
 ... get data ...
});
stream.on('end',function () {
 ... do something for complete data...
})
container.modem.demuxStream(stream, logStream, logStream);

i think this demand that get exec result is very common so maybe can provide a endCallback in demuxStream or just add a example in dockerode let people can find way faster

thx

apocas commented 5 years ago

Why not listen to the stream's end event outside docker-modem? Just like you exemplified. I think it's better to just add an example instead of adding redundant functionalities.

When possible always "userland" :)