lib/decoder.js
function _bst(chunk, type) {
  // we should have already read the chunk
  var len = this._int(chunk, type), buf;
  if(!isNaN(len)) {
    // read an integer less than zero, treat as null
    if(len < 0) return null;
    // read in the entire bulk string and swallow the crlf
    if((chunk.length - this._offset) >= len + 2) {
      buf = chunk.slice(this._offset, this._offset + len);
      this._offset += (len + 2);
      //this._buffer = this._buffer.slice(this._offset, this._buffer.length);
      //console.dir(buf);
      return this.buffers ? buf : '' + buf;
    }else{
      this._wait();
    }
  }
}
function _bst(chunk, type) {
  // we should have already read the chunk
  var len = this._int(chunk, type), buf;
  if(!isNaN(len)) {
    // read an integer less than zero, treat as null
    if(len < 0) return null;
    // read in the entire bulk string and swallow the crlf
    if((chunk.length - this._offset) >= len + 2) {
      buf = chunk.slice(this._offset, this._offset + len);
      this._offset += (len + 2);
      //this._buffer = this._buffer.slice(this._offset, this._buffer.length);
      //console.dir(buf);
      return this.buffers ? buf : '' + buf;
    }else{
      this._wait();
    }
  }
}
function _bst ( chunk , type ) { // we should have already read the chunk var len = this . _int ( chunk , type ) , buf ; if ( ! isNaN ( len ) ) { // read an integer less than zero, treat as null if ( len < 0 ) return null ; // read in the entire bulk string and swallow the crlf if ( ( chunk . length - this . _offset ) >= len + 2 ) { buf = chunk . slice ( this . _offset , this . _offset + len ) ; this . _offset += ( len + 2 ) ; //this._buffer = this._buffer.slice(this._offset, this._buffer.length); //console.dir(buf); return this . buffers ? buf : '' + buf ; } else { this . _wait ( ) ; } } }
Read a bulk string.
Read a bulk string .