index.js
function readUntil(stream, until, options) {
  if (typeof until !== 'function') {
    // Note:  Synchronous Yaku emits unhandledRejection before returning.
    // Best current option is to use an async promise, even when flowing
    const ReadPromise = (options && options.Promise) || Promise;
    return ReadPromise.reject(new TypeError('until must be a function'));
  }
  return readInternal(stream, undefined, until, options);
}
function readUntil(stream, until, options) {
  if (typeof until !== 'function') {
    // Note:  Synchronous Yaku emits unhandledRejection before returning.
    // Best current option is to use an async promise, even when flowing
    const ReadPromise = (options && options.Promise) || Promise;
    return ReadPromise.reject(new TypeError('until must be a function'));
  }
  return readInternal(stream, undefined, until, options);
}
function readUntil ( stream , until , options ) { if ( typeof until !== 'function' ) { // Note:  Synchronous Yaku emits unhandledRejection before returning. // Best current option is to use an async promise, even when flowing const ReadPromise = ( options && options . Promise ) || Promise ; return ReadPromise . reject ( new TypeError ( 'until must be a function' ) ) ; } return readInternal ( stream , undefined , until , options ) ; }
Reads from a stream.Readable until a given test is satisfied.
@param {stream.Readable} stream Stream from which to read.
@param {function((!Buffer|string|!Array), (Buffer|string|*)): number|boolean}
test Test function called with the data read so far and the most recent
chunk read.  If it returns a negative or falsey value, more data will be
read.  If it returns a non-negative number and the stream can be unshifted,
that many bytes will be returned and the others will be unshifted into the
stream.  Otherwise, all data read will be returned.  If it returns a number
larger than the length of the data read so far, enough data to reach the
requested length will be read before returning.  Non-numeric, non-boolean
values will result in an error.
@param {ReadOptions=} options Options.
@return {Promise<!Buffer|string|!Array>|
CancellableReadPromise<!Buffer|string|!Array>} Promise with the data read
and not unshifted, or an Error if one occurred.  If <code>'end'</code> is
emitted before <code>until</code> returns a non-negative/true value, an
{@link EOFError} is returned.  If an error occurs after reading some data,
the <code>.read</code> property of the error object will contain the partial
read result.  The promise is resolved synchronously for streams in flowing
mode (see README.md for details).
Reads from a stream . Readable until a given test is satisfied .