dist/irisLib.js
function copyFromBuffer(n, list) {
	  var ret = Buffer.allocUnsafe(n);
	  var p = list.head;
	  var c = 1;
	  p.data.copy(ret);
	  n -= p.data.length;
	  while (p = p.next) {
	    var buf = p.data;
	    var nb = n > buf.length ? buf.length : n;
	    buf.copy(ret, ret.length - n, 0, nb);
	    n -= nb;
	    if (n === 0) {
	      if (nb === buf.length) {
	        ++c;
	        if (p.next) list.head = p.next;else list.head = list.tail = null;
	      } else {
	        list.head = p;
	        p.data = buf.slice(nb);
	      }
	      break;
	    }
	    ++c;
	  }
	  list.length -= c;
	  return ret;
	}
function copyFromBuffer(n, list) {
	  var ret = Buffer.allocUnsafe(n);
	  var p = list.head;
	  var c = 1;
	  p.data.copy(ret);
	  n -= p.data.length;
	  while (p = p.next) {
	    var buf = p.data;
	    var nb = n > buf.length ? buf.length : n;
	    buf.copy(ret, ret.length - n, 0, nb);
	    n -= nb;
	    if (n === 0) {
	      if (nb === buf.length) {
	        ++c;
	        if (p.next) list.head = p.next;else list.head = list.tail = null;
	      } else {
	        list.head = p;
	        p.data = buf.slice(nb);
	      }
	      break;
	    }
	    ++c;
	  }
	  list.length -= c;
	  return ret;
	}
function copyFromBuffer ( n , list ) { var ret = Buffer . allocUnsafe ( n ) ; var p = list . head ; var c = 1 ; p . data . copy ( ret ) ; n -= p . data . length ; while ( p = p . next ) { var buf = p . data ; var nb = n > buf . length ? buf . length : n ; buf . copy ( ret , ret . length - n , 0 , nb ) ; n -= nb ; if ( n === 0 ) { if ( nb === buf . length ) { ++ c ; if ( p . next ) list . head = p . next ; else list . head = list . tail = null ; } else { list . head = p ; p . data = buf . slice ( nb ) ; } break ; } ++ c ; } list . length -= c ; return ret ; }
Copies a specified amount of bytes from the list of buffered data chunks. This function is designed to be inlinable, so please take care when making changes to the function body.
Copies a specified amount of bytes from the list of buffered data chunks . This function is designed to be inlinable so please take care when making changes to the function body .