function validate(dataBuffer, start, dataLen) {
    precon.opt_buffer(dataBuffer, 'dataBuffer');
    precon.opt_positiveInteger(start, 'start');
    precon.opt_positiveInteger(dataLen, 'dataLen');

    if (!dataBuffer)
        return false;

    start = start || 0;
    dataLen = typeof dataLen === 'number' ? dataLen : (dataBuffer.length - start);

    if (dataLen < MIN_BYTES)
        return false;

    if (start >= dataBuffer.length)
        return false;

    if (start + dataLen > dataBuffer.length)
        return false;

    // check that actual data is at least as long as the indicated data length
    const expectedLen = dataBuffer.readUInt32LE(start);
    return expectedLen >= MIN_BYTES && dataLen >= expectedLen;
}
/**
 * Quickly validates serialized data by ensuring the supplied Buffer is complete.
 *
 * @param [dataBuffer] {Buffer}  The Buffer with serialized data to validate
 * @param [start=0]    {number}  The index position of the start of the data to deserialize.
 * @param [dataLen]    {number}  The length of data after index position in dataBuffer to consider.
 *
 * @returns {boolean} True if validated, otherwise false.
 */
Quickly validates serialized data by ensuring the supplied Buffer is complete.
@param [dataBuffer] {Buffer}  The Buffer with serialized data to validate
@param [start=0]    {number}  The index position of the start of the data to deserialize.
@param [dataLen]    {number}  The length of data after index position in dataBuffer to consider.

@returns {boolean} True if validated, otherwise false.
Quickly validates serialized data by ensuring the supplied Buffer is complete . @param [ dataBuffer ] { Buffer } The Buffer with serialized data to validate @param [ start = 0 ] { number } The index position of the start of the data to deserialize . @param [ dataLen ] { number } The length of data after index position in dataBuffer to consider . @returns { boolean } True if validated otherwise false .
function validate(dataBuffer, start, dataLen) {
    precon.opt_buffer(dataBuffer, 'dataBuffer');
    precon.opt_positiveInteger(start, 'start');
    precon.opt_positiveInteger(dataLen, 'dataLen');
    if (!dataBuffer)
        return false;
    start = start || 0;
    dataLen = typeof dataLen === 'number' ? dataLen : (dataBuffer.length - start);
    if (dataLen < MIN_BYTES)
        return false;
    if (start >= dataBuffer.length)
        return false;
    if (start + dataLen > dataBuffer.length)
        return false;
    const expectedLen = dataBuffer.readUInt32LE(start);
    return expectedLen >= MIN_BYTES && dataLen >= expectedLen;
}
function validate ( dataBuffer , start , dataLen ) { precon . opt_buffer ( dataBuffer , 'dataBuffer' ) ; precon . opt_positiveInteger ( start , 'start' ) ; precon . opt_positiveInteger ( dataLen , 'dataLen' ) ; if ( ! dataBuffer ) return false ; start = start || 0 ; dataLen = typeof dataLen === 'number' ? dataLen : ( dataBuffer . length - start ) ; if ( dataLen < MIN_BYTES ) return false ; if ( start >= dataBuffer . length ) return false ; if ( start + dataLen > dataBuffer . length ) return false ; const expectedLen = dataBuffer . readUInt32LE ( start ) ; return expectedLen >= MIN_BYTES && dataLen >= expectedLen ; }
Quickly validates serialized data by ensuring the supplied Buffer is complete.
Quickly validates serialized data by ensuring the supplied Buffer is complete .
// check that actual data is at least as long as the indicated data length