function ReadMachine()

in stream/read_machine.js [35:50]


function ReadMachine(sizeRW, chunkRW, emit) {
    if (!(this instanceof ReadMachine)) {
        return new ReadMachine(sizeRW, chunkRW, emit);
    }
    // istanbul ignore if
    if (typeof sizeRW.width !== 'number') {
        throw errors.expected(sizeRW, 'atomic RW');
    }
    this.sizeRW = sizeRW;
    this.chunkRW = chunkRW;
    this.buffer = new ConcatReadBuffer();
    this.expecting = this.sizeRW.width;
    this.state = States.PendingLength;
    // istanbul ignore else
    if (typeof emit === 'function') this.emit = emit;
}