lib/usb/usb-process.js
function RemoteReadableStream(process, daemon, ackHeaderFunc) {
  // Inherit from Readable Streams
  stream.Readable.call(this);
  // The id of the process of this stream
  this.process = process;
  // The daemon to write data to
  this.daemon = daemon;
  // The function we use to generate acknowledgement packets
  this.ackHeaderFunc = ackHeaderFunc;
  // The amount of backpressure credit on this stream
  this.credit = 0;
  // A flag indicating whether this stream was closed
  this.closed = false;

  // This puts the stream into 'flowing mode'
  // so that the stream emits ('end') events without 'data' listeners
  this.resume();

  // When we receive data from the daemon, we handle it
  this.on('incoming', (data) => this.handleIncoming(data));
}
function RemoteReadableStream(process, daemon, ackHeaderFunc) {
  // Inherit from Readable Streams
  stream.Readable.call(this);
  // The id of the process of this stream
  this.process = process;
  // The daemon to write data to
  this.daemon = daemon;
  // The function we use to generate acknowledgement packets
  this.ackHeaderFunc = ackHeaderFunc;
  // The amount of backpressure credit on this stream
  this.credit = 0;
  // A flag indicating whether this stream was closed
  this.closed = false;

  // This puts the stream into 'flowing mode'
  // so that the stream emits ('end') events without 'data' listeners
  this.resume();

  // When we receive data from the daemon, we handle it
  this.on('incoming', (data) => this.handleIncoming(data));
}
A wrapper on the Node Readable Stream to encapsulate stdout & stderr stream functionality